Searching for "database."

Q:

You are the database administrator of a SQL Server 2000 computer. The server contains your company's Accounts database. Hundreds of users access the database each day.Because you have had power interruptions in the past, you want to protect the physical integrity of the Accounts database. You do not want to slow down server operations.What should you do?

A) Create a database maintenance plan to check database integrity and make repairs each night. B) Enable the torn page detection database option for each database.
C) Disablewrite caching on all disk controllers. D) Ensure that write caching disk controllers have battery backups.
 
Answer & Explanation Answer: D) Ensure that write caching disk controllers have battery backups.

Explanation:

The scenario states that power interruptions have occurred in the past. By buying a battery backup solution for the disk controllers the power interruption problem would be prevented.

Report Error

View Answer Report Error Discuss

Q:

You are an administrator of a SQL Server 2000 computer. The server contains a database that stores inventory data. Another database administrator has created a number of scheduled jobs to maintain the inventory database. Each weeknight the following jobs occur.


- A BULK INSERT job imports data at 10:00 P.M
- Indexes are rebuilt at 10:15 P.M
- Data integrity checks are performed at 10:30 P.M
- A differential backup is performed at 10:45 P.M
- A DBCC SHRINKDATABASE job runs at 11:00 P.M.


You notice that the final job often fails and returns the following error message: "Server: Msg 3140, Level 16, State 3. Could not adjust the space allocation for file  'inventory_data'."You need to ensure that the final job runs without errors.

What should you do?

A) Modify the DBCC SHRINKDATABASE job so that it uses DBCC SHRINKFILE statement to shrink each file individually. B) Create a new DBCC SHRINKFILE job to shrink the inventory_data file. Schedule the new job to run at the same time as the DBCC SHRINKDATABASE job.
C) Increase the time between the differential backup and the DBCC SHRINKDATABASE job. D) Increase the time between the data integrity checks and the differential backup.
 
Answer & Explanation Answer: C) Increase the time between the differential backup and the DBCC SHRINKDATABASE job.

Explanation:

The DBCC SHRINKDATABSE cannot be executed until the previous job step, the differential backup, has been completed. We should increase the time between these two job steps, or even better configure the last job step to run only after the differential backup has been completed.

 

Note: The DBCC SHRINKDATABASE statement shrinks data files on a per-file basis but shrinks log files as if all the log files existed in one contiguous log pool. The target size for the data and log files cannot be smaller than the minimum size of a file that was specified when the file was originally created, or the last explicit size set with a file size changing operation such as the ALTER DATABASE statement with the MODIFY FILE option or the DBCC SHRINKFILE statement.

Report Error

View Answer Report Error Discuss

Q:

You are the administrator of a SQL Server 2000 computer. The server contains a database named FinanceData that is used by a client/server application. Each employee has a SQL Server login that the application uses to access the server.Your company hires a new employee named Andrew. You create a SQL Server login named Andrew. You also create a database user named Andrew in the database and grant the database user full permissions in the database.Whenever Andrew runs the client/server application, he receives the following error message: "Invalid object name." Andrew also reports that he cannot access the database by using the application.You need to ensure that Andrew can use the application. Which Transact-SQL statement should you execute?

A) EXEC sp_defaultdb 'Andrew','FinanceData' B) GRANT ALL ON FinanceData TO Andrew
C) EXEC sp_addlogin 'Andrew' D) EXEC sp_grantdbaccess 'FinanceData','Andrew'GOsp_addrolemember 'db_datareader','Andrew'
 
Answer & Explanation Answer: A) EXEC sp_defaultdb 'Andrew','FinanceData'

Explanation:

Error 208 produces the message 'Invalid object name' and occurs when an object that does not exist in the current database is referenced. If the object exists in another database, we must use the USE statement to explicitly switch the context to the correct database or we must qualify the object name with the database name. A third option is to use the sp_defaultdb stored procedure. This stored procedure is used to change the default database for a login. When a client connects with SQL Server, the default database defined for its login becomes the current database without an explicit USE statement. The default database can be defined when the login is added with
sp_addlogin. When executing sp_addlogin the master database is the default database if a database is not specified. In this scenario a SQL Server 2000 login and a user account has been created for Andrew and he has been given database access and the required permissions.

Report Error

View Answer Report Error Discuss

Q:

You are the database administrator for a financial services company. Employees enter data 24 hours a day into a SQL Server 2000 database. These employees report slower response times when new account information is gathered from branch offices and added to the database. You currently use the following BULK INSERT statement to add the account information.BULK INSERT finance.dbo.customersFROM 'd:bulkaccts143_10142000.txt'WITH DATAFILETYPE = 'char', FIELDTERMINATOR = 't', ROWTERMINATOR = 'n', TABLOCK You want to ensure that response times do not slow when new account information is added to the database. What should you do?

A) Add the BATCHSIZE option to the BULK INSERT statement, and then set the option equal to 10 percent of the number of rows to be loaded. B) Add the ROWS_PER_BATCH option to the BULK INSERT statement, and then set the option equal to 10 percent of the number of rows to be loaded.
C) Drop the indexes for the Customers table before the data load, and then re-create the indexes after the data load is complete. D) Remove the TABLOCK option from the BULK INSERT statement.
 
Answer & Explanation Answer: D) Remove the TABLOCK option from the BULK INSERT statement.

Explanation:

The TABLOCK hint increases the number of locks during the adding process. This is the reason why response time are slows down during this process. By removing the TABLOCK hint the default more granular row-level lock will be used. This would decrease the scope of the locks which would result in less waiting jobs and performance would improve.


Note: The BULK INSERT statement is used to copy a data file into a database table or view in a format specified by the user. The BULK INSERT statement accepts the TABLOCK hint, which allows the user to specify the locking behavior that the BULK INSERT statement should use. TABLOCK specifies that a bulk update table-level lock is taken for the duration of the bulk copy. If TABLOCK is not specified, the default uses row-level locks.

Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft ADO.NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. You use the ADO.NET LINQ to SQL model to retrieve data from the database. You use stored procedures to return multiple result sets. You need to ensure that the result sets are returned as strongly typed values. What should you do?

A) Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult B) Apply the FunctionAttribute and ParameterAttribute to the stored procedure function and directly access the strongly typed object from the results collection.
C) Apply the ResultTypeAttribute to the stored procedure function and directly access the strongly typed object from the results collection. D) Apply the ParameterAttribute to the stored procedure function. Use the GetResult
 
Answer & Explanation Answer: A) Apply the FunctionAttribute and ResultTypeAttribute to the stored procedure function. Use the GetResult

Explanation:
Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an
application. The application connects to a Microsoft SQL Server database. The application stores encrypted credit card numbers in the database. You need to ensure that credit card numbers can be extracted from the database.
Which cryptography provider should you use?

A) DSACryptoServiceProvider B) AESCryptoServiceProvider
C) MD5CryptoServiceProvider D) SHA1CryptoServiceProvider
 
Answer & Explanation Answer: B) AESCryptoServiceProvider

Explanation:
Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an
application. The application connects to a Microsoft SQL Server database. The application has two DataTable objects that reference the Customers and Orders tables in the database. The application contains the following code segment. (Line numbers are included for reference only.)


01DataSet customerOrders = new DataSet();
02customerOrders.EnforceConstraints = true;
03ForeignKeyConstraint ordersFK = new ForeignKeyConstraint("ordersFK",
04customerOrders.Tables["Customers"].Columns["CustomerID"],
05customerOrders.Tables["Orders"].Columns["CustomerID"]);
06
07customerOrders.Tables["Orders"].Constraints.Add(ordersFK);


You need to ensure that an exception is thrown when you attempt to delete Customer records that have related Order records. Which code segment should you insert at line 06?

A) ordersFK.DeleteRule = Rule.SetNull; B) ordersFK.DeleteRule = Rule.None;
C) ordersFK.DeleteRule = Rule.SetDefault; D) ordersFK.DeleteRule = Rule.Cascade;
 
Answer & Explanation Answer: B) ordersFK.DeleteRule = Rule.None;

Explanation:
Report Error

View Answer Report Error Discuss

Q:

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an
application. The application connects to a Microsoft SQL Server 2008 database. The database includes a table named dbo.


Documents that contains a column with large binary dat a. You are creating the Data Access Layer (DAL). You add the following code segment to query the dbo.Documents table. (Line numbers are included for reference only.)


01public void LoadDocuments(DbConnection cnx)
02{
03var cmd = cnx.CreateCommand();
04cmd.CommandText = "SELECT * FROM dbo.Documents";
05...
06cnx.Open();
07
08ReadDocument(reader); }


You need to ensure that data can be read as a stream. Which code segment should you insert at line 07?

A) var reader = cmd.ExecuteReader(CommandBehavior.Default); B) var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
C) var reader = cmd.ExecuteReader(CommandBehavior.KeyInfo); D) var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
 
Answer & Explanation Answer: D) var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);

Explanation:
Report Error

View Answer Report Error Discuss