Which procedure should you use?

You maintain a SQL Server 2008 instance that contains a database named Finance. The
data file and the transaction log file are located on the E: drive. The E: drive has only 5
percent available space.
You need to move both files to the V: drive.
Which procedure should you use?

You maintain a SQL Server 2008 instance that contains a database named Finance. The
data file and the transaction log file are located on the E: drive. The E: drive has only 5
percent available space.
You need to move both files to the V: drive.
Which procedure should you use?

A.
Run the following Transact-SQL statement. ALTER DATABASE Finance SET
RESTRICTED_USER WITH ROLLBACK_IMMEDIATE; Move the data file and transaction
log file to the new location. Run the following Transact-SQL statements. ALTER DATABASE
Finance MODIFY FILE ( NAME = Finance_Data, FILENAME =
‘v:\SQLServer\Finance_Data.mdf’); ALTER DATABASE Finance SET MULTI_USER;

B.
Run the following Transact-SQL statement. ALTER DATABASE Finance SET OFFLINE
WITH ROLLBACK_IMMEDIATE; Move the data file and transaction log file to the new
location. Run the following Transact-SQL statements. ALTER DATABASE Finance MODIFY
FILE (NAME = Finance_Data, FILENAME = ‘v:\SQLServer\Finance_Data.mdf’); ALTER
DATABASE Finance MODIFY FILE (NAME = Finance_Log, FILENAME =
‘v:\SQLServer\Finance_Log.ldf’); ALTER DATABASE Finance SET ONLINE;

C.
Stop the SQL Server service. Move the data file to the new location. Start the SQL Server
service. Run the following Transact-SQL statement. EXEC sp_attach_single_file_db
@dbname = N’Finance’, @physname = N’v:\SQLServer\Finance_Data.mdf’;

D.
Stop the SQL Server Service. Move the data file and transaction log file to the new
location. Start the SQL Server service. Run the following Transact-SQL statement. EXEC
sp_attach_db @dbname = N’Finance’, @filename1 = N’v:\SQLServer\Finance_Data.mdf’,
@filename2 = N’v:\SQLServer\Finance_Log.ldf’;



Leave a Reply 0

Your email address will not be published. Required fields are marked *