SQL Server Questions and Answers – Transferring Database

This set of SQL Server Multiple Choice Questions & Answers (MCQs) focuses on “Transferring Database”.

1. Which of the following wizard provides creation logins on the destination server?
a) Copy Database
b) Move Database
c) Detach database
d) Attach database
View Answer

Answer: a
Explanation: The Copy Database Wizard lets you move or copy databases and their objects easily from one server to another.

2. Point out the correct statement.
a) After a database has been upgraded, it cannot be downgraded to a previous version
b) The Copy Database Wizard is available in the Express edition
c) The Copy Database Wizard cannot be used to copy System databases
d) None of the mentioned
View Answer

Answer: c
Explanation: System databases cannot be transferred using Copy database wizard.

3. How many ways are provided by SQL Server to copy a database?
a) 2
b) 3
c) 4
d) 5
View Answer

Answer: b
Explanation: SQL Server provides mainly three ways to copy a database.
advertisement
advertisement

4. Which is not the preferred way of copying a database?
a) Using the Copy Database Wizard
b) Restoring a database backup
c) Using the Generate Scripts Wizard to publish databases
d) None of the mentioned
View Answer

Answer: c
Explanation: Generate script wizard produces unnecessary computation internally to copy a database.

5. Point out the wrong statement related to the use of Copy database wizard.
a) Pick a source and destination server
b) System stored procedures
c) Schedule when to move or copy the databases
d) None of the mentioned
View Answer

Answer: b
Explanation: Copy database wizard copies additional supporting objects, jobs, user-defined stored procedures, and error messages.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. Which of the following returns a list of the database and log files?
a) RESTORE FILELISTON
b) RESTORE FILELIST
c) RESTORE FILELISTONLY
d) All of the mentioned
View Answer

Answer: c
Explanation: A client can use RESTORE FILELISTONLY to obtain a list of the files contained in a backup set. This information is returned as a result set containing one row for each file.

7. Which of the following transfer method makes the database unavailable to users during the transfer?
a) Detach and attach method
b) SQL Management Object method
c) Restore method
d) None of the mentioned
View Answer

Answer: a
Explanation: Detach the database from the source server, copy the database files to the destination server, and attach the database at the destination server.

advertisement

8. Which of the following stored procedure is used for detachment of database?
a) sp_replicationdboption
b) sp_replicationdb
c) sp_replicationoption
d) all of the mentioned
View Answer

Answer: a
Explanation: If you cannot use sp_replicationdboption, you can remove replication by running sp_removedbreplication.

9. Which of the following code snippet will detach AdventureWorks2012 database?
a)

advertisement
USE master;
GO
EXEC xp_detach_db @dbname = N'AdventureWorks2012';
GO

b)

USE master;
GO
EXEC sp_detach @dbname = N'AdventureWorks2012';
GO

c)

USE master;
GO
EXEC sp_detach_db @dbname = N'AdventureWorks2012';
GO

d)

USE master;
GO
EXEC sp_det_db @dbname = N'AdventureWorks2012';
GO
View Answer
Answer: c
Explanation: sp_detach_db detaches a database that is currently not in use from a server instance.

10. Which of the code is valid for attaching the database?
a)

USE master;
GO
CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Log.ldf')
    FOR ATTACH;
GO

b)

USE master;
GO
CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Log.ldf')
    TO ATTACH;
GO

c)

USE master;
GO
CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Log.ldf')
    FOR ATTACH_DB;
GO

d) None of the mentioned
View Answer

Answer: a
Explanation: Attach the moved database and, optionally, its log by executing the following Transact-SQL statements.

Sanfoundry Global Education & Learning Series – SQL Server.

To practice all areas of SQL Server, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.