You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to facilitate a large import of data, and rebuild them after the import is complete.Users report that response times from a stored

题目

You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to facilitate a large import of data, and rebuild them after the import is complete.

Users report that response times from a stored procedure have become slower. In the stored procedure, you examine the following code.

CREATE PROCEDURE GetCustomer

( @CustomerID Int )

AS

SELECT FirstName, LastName, Address1, Address2, City,

State, Zip, MAX(PurchaseDate) AS LastPurchase

FROM Customers C

JOIN Addresses A ON A.AddressID = C.AddressID

JOIN Purchases P ON P.CustomerID = C.CustomerID

WHERE C.CustomerID = @CustomerID

GROUP BY FirstName, LastName, Address1, Address2, City, State, Zip

You want to improve the performance of the procedure by using the least amount of administrative effort. What should you do?

A.Recompile the stored procedure.

B.Update the database statistics.

C.Check the consistency of the database and repair errors.

D.Create a view and modify the stored procedure to use the view.

参考答案和解析
正确答案:A
解析:Explanation:ByrecompilingthestoredprocedureSQLServerwillcreateanewexecutionplanforthestatementsintheprocedure.SQLServerwilldetectthatstatisticsarenotuptodateanditwillautomaticallyrecreatethestatisticsduringthisprocess.Theexecutionplanwillbeoptimizedforthecurrentdistributionofdatainthetables.Note:Storedprocedurescanbeusedtoimprovedatabasequeryperformance.IftheseSQLstatementsandconditionallogicarewrittenintoastoredprocedure,theybecomepartofasingleexecutionplanthatiscachedontheserver.Whenthedatabaseischangedbytheadditionofnewindexesorwhendatainindexedcolumnsarechanged,theoriginalqueryplansandstoredproceduresusedtoaccessthetablesshouldbereoptimizedbyrecompilingthem.ThisoptimizationhappensautomaticallythefirsttimeastoredprocedureisrunafterSQLServer2000isrestarted.Italsooccursifanunderlyingtableusedbythestoredprocedurechanges.Butifanewindexisaddedfromwhichthestoredproceduremightbenefit,optimizationdoesnotautomaticallyoccuruntilthenexttimethestoredprocedureisrunafterSQLServerisrestarted.Thestoredprocedurecanbemanuallyrecompiledbyusingthesp_recompilesystemstoredprocedure.Thisforcesthestoredproceduretoberecompiledthenexttimeitisrun.IncorrectAnswers:B:SQLServerdetectswhetherstatisticsarenotup-to-date,andbydefaultitautomaticallyupdatesthemduringqueryoptimization.Byrecompilingthequerythestatisticswillautomaticallybeupdated.Note:SQLServerkeepsstatisticsaboutthedistributionofthekeyvaluesineachindexandusesthesestatisticstodeterminewhichindex(es)touseinqueryprocessing.Queryoptimizationdependsontheaccuracyofthedistributionsteps.Ifthereissignificantchangeinthekeyvaluesintheindex,orifalargeamountofdatainanindexedcolumnhasbeenadded,changed,orremoved,orthetablehasbeentruncatedandthenrepopulated,UPDATESTATISTICSshouldbererun.C:Consistencyofadatabaseismaintainedthroughtheuseofconstraintsandtriggers.Thesemechanismsareusedtoensurethatthedatabaseremainsconsistentbycontrollingthetypeofdatathatcanbeinsertedintoacolumn,throughreferentialintegritychecks,andthroughcascadingreferentialconstraints.D:Aviewisavirtualtablethatcanbeusedtorestrictusersaccesstothebasetable,ortojoinvariousbasetablessothattheyappearasasingletable.However,creatingaviewthatthestoredproceduremustaccesswouldrequirethecreationofindexesontheviewandwillhavetobeupdatedwhenthebasetablesareupdates.Thiswouldrequiregreateradministrativeeffort.
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

You are the administrator of a SQL Server 2000 database. You import a table of geographic information from a Microsoft access database into a SQL Server 2000 database. The table has 12,000 rows. Each row averages 5,000 bytes. The table contains lockup data that does not change.

You want to minimize the size of the data file and the time required to back up the data. Which two actions should you take? (Each correct answer presents part of the solution. Choose two)

A. Create a 60-MB data file named geography.ndf

B. Create a 95-MB data file named geography.ndf

C. Create a 60-MB data file named geography.mdf

D. Create a 95-MB data file named geography.mdf

E. Place the table in the PRIMARY filegroup.

F. Place the table in a new filegroup named LOCATION.


正确答案:BF
B,F 解析:Explanation: As SQL Server 2000 supports backing up or restoring individual files or file groups within a database, it is possible to reduce back up time by creating a separate data file table so that only that table will be backed up. This separate data file will have to be a secondary data file because a database can only have one primary data file, which is identified by the .mdf extension, it is the starting point of the database and locates all the other files in the database. Secondary data files are identified by the .ndf extension and comprise all of the data files except the primary data file. A database need not have a secondary data file and it is also possible to create multiple secondary data files on database.

Rows are stored in data pages. Rows cannot cross different data pages. The size of data page in SQL Server 2000 (or SQL 7.0) is 8,192 bytes. We can only store one row in every data page in this scenario. Thus, to estimate the size of the tale we would need to multiply the number of rows, 12,000 in this scenario, by 8,192 bytes. This will give us a table size of 98,304,000 bytes. As computer data storage is calculated using the binary rather than the decimal system, there is 1,024 bytes per Kb and 1,024 Kb per MB, rather than 1,000 bytes per Kb and 1,000 Kb per MB, we thus require a database size of at least 93.75 MB.

Incorrect Answers:
A: The data size of this table is insufficient as a minimum size of 93.75 MB is required.

C: The data size of this table is insufficient as a minimum size of 93.75 MB is required. Furthermore, the .mdf file extension indicate in this solution implies that the data file will be placed in the primary filegroup. It would thus not be possible to backup the data file pertaining to the table only.

D: The .mdf file extension indicate in this solution implies that the data file will be placed in the primary filegroup. It would thus not be possible to backup the data file pertaining to the table only.

E: As SQL Server 2000 supports backing up or restoring individual files or file groups within a database, it is possible to reduce back up time by creating a separate data file table so that only that table will be backed up. This separate data file will have to be a secondary data file because a database can only have one primary data file, which is identified by the .mdf extension, it is the starting point of the database and locates all the other files in the database.

第2题:

You are the administrator of a SQL Server 2000 computer. The server contains database named Sales. Users report that they cannot add new data to the database. You examine the properties of the database. The database is configured as shown in the Sales Properties exhibit.

You examine drive E. The hard disk is configured as shown in the Local Disk Properties exhibit.

You want the users to be able to add data, and you want to minimize administrative overhead. What should you do?

A.Increase the maximum file size of Sales_Data to 1,500MB.

B.Use the DBCC SHRINKDATABASE statement.

C.Set automatic file growth to 10 percent.

D.Create another data file named Sales_Data2 in a new SECONDARY filegroup.


正确答案:A
解析:Explanation: By examining the first exhibit we see that the database has reached its maximum size of 1001 MB. The data file is located on drive E and the second exhibit shows us that there is enough free space on that disk to increase the maximum size of the data file to 1,500 MB.

Incorrect Answers:
B: DBCC SHRINKDATABASE could possibly shrink the database and new records could be added for a while, but it would just be a temporary solution.

C: The database is already set to automatic file growth, but it has reached the maximum size.

D: The primary file has reached it maximum size. A secondary filegroup would help if it was set to the default file group. New data would still be added to the primary filegroup which is at its maximum size.

第3题:

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.customers

FROM ‘di\bulk\accts143_10141000.txt’

WITH DATAFILETYPE = ‘char’,

FIELD/TERMINATOR = ‘\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.Drop the indexes for the customers table before the data load, and then re-create the indexes after the data load is complete.

B.Remove the TABLOCK option from the BULK INSERT statement.

C.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.

D.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.


正确答案:B
解析: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.

Incorrect Answers:
A: The recommendation to perform. the bulk copy operation with the indexes in place depends on the amount of data to be copied into the table compared to the amount of existing data already in the table. The large the amount of data to be loaded into a table, relative to the amount of data already in the table, the more efficient it is to drop all indexes on the table, perform. the bulk copy operation, and then re-create the indexes after the data is loaded

C: The BATCHSIZE option of the BULK INSERT statement is used to specify that SQL Server 2000 must treat each batch of rows inserted into the table as a separate transaction. This is useful when errors occur in the bulk copy operation, which would cause the transaction to be rolled back. By specifying the BATCHSIZE option, only the current transaction will be rolled back if an error occurs and the destination table still contains the other batches of rows that were successfully inserted.

D: The ROWS_PER_BATCH option of the BULK INSERT statement SQL Server can be used to
indicate the approximate number of rows in a batch. SQL Server 2000 then optimizes the load automatically, according to the batch size value, which may result in better performance. Although accuracy in the clause is not critical, the larger the batch size is, the better the performance of the bulk copy operation.

第4题:

You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. The company wants to export data from SQL Server to a Microsoft Excel file. The company assigns this task to you. You perform this by using the SQL Server Import and Export Wizard. After this, you save the package definition to a file. Now you have to reexecute the package from the command line.  In the options below, which utility should you choose to use?()

  • A、bcp.exe 
  • B、dta.exe 
  • C、dtexec.exe 
  • D、sqlmaint.exe

正确答案:C

第5题:

You work in Dublin at the main office of TestKing.com. You are responsible for managing a SQL Server 2005 database. The sales department wants a report that compares customer activity in the previous quarter between the main office in Dublin and the branch office in Buenos Aires. They want the data sorted by surname and first name.You restore a recent backup of the Buenos Aires database onto your server. You write queries to build the report, ordering the data by the Surname and FirstName columns. You review the data and notice that the customer list from the Buenos Aires database is sorted differently. The sales department needs the revised data within 15 minutes for a presentation.  You need to implement the fastest possible solution that ensures that the data from both databases is sorted identically. What should you do?()

  • A、Use the Copy Database Wizard to copy the data in the Buenos Aires database to a new database with the same collation as the Dublin database.
  • B、Use the SQL Server Import and Export Wizard to copy the data from the Buenos Airesdatabase into new tables, specifying the same collation as the Dublin database.
  • C、Modify the format file to specify the same collation as the Dublin database. Import the table again.
  • D、Modify the query on the Buenos Aires database to use the COLLATE setting in the ORDER BY clause. In the query, specify the same collation as the Dublin database.

正确答案:D

第6题:

You are the administrator of two SQL Server 2000 computers. One of these servers contains a 4-GB database named marketing. You want to remove the marketing database from one server and add it to the other as quickly as possible.

What should you do?

A.Detach the database from the original server by using the sp_detach_db stored procedure. Copy the database and the transaction log files to the new server, and attach them by using the sp_attach_db stored procedure.

B.Use the DTS export wizard to transfer all database objects from the original server to the new server. Drop the database from the original server.

C.Run a full backup of the database on the original server. Create a new database named marketing on the new server. Restore the backup in the new marketing database. Drop the database from the original server.

D.Shut down the original server. Copy the database and the transaction log files to the new server. Use the DISK INIT and DISK REFIT statements to attach the data file to the new server. Drop the database from the original server.


正确答案:A
解析:Explanation:Detachingandattachingdatabasesissometimesausefultechniqueforquicklymovingadatabasefromonecomputertoanother.Tomoveadatabase,ordatabasefile,toanotherserverordiskthedatabasemustfirstbedetachedfromtheoriginalserverordisk;movedtotheotherserverordiskandthenattachedontheserverordisk.Inadditionthenewlocationofthemovedfile(s)mustbespecified.Thesp_detach_dbstoredprocedureisusedtodetachthedatabaseandcanrunUPDATESTATISTICSonalltablesbeforedetachingthedatabasewhilethesp_attach_dbstoredprocedureisusedtoattachthedatabaseinitsnewlocation.IncorrectAnswers:B:DTScanimportdatafromatextfileorfromanOLEDBdatasourcesuchasaMicrosoftAccess2000databaseintoSQLServer.ItcanalsoexportdatafromSQLServertoanOLEDBdatadestination.Itprovidesforhigh-speeddataloadingfromtextfilesintoSQLServertables.However,itisnotthefastestwaytomoveawholedatabasefromoneservertoanother.C:Beforeadatabasecanberestoredfromabackuptoanewlocation;thedatabasemustfirstberecreatedinthedestinationasthebackupholdsonlythedatafilesthatbelonginthevarioustables.Itdoesnotholdthetabledefinitions.Thisisnotthefastestmethodtomoveadatabase.D:TheDISKINITandDISKREFITcommandscannotbeusedtomoveadatabasefromoneservertoanother.Note:DISKINITandDISKREINITarefeaturesthatareusedinaSQLServer6.x.inSQLServer6.x,DISKINITisusedtocreatedatabaseortransactionlogdevicestostorethespecifieddatabaseortransactionlogwhenDISKINITfollowedeitheraCREATEDATABASEorALTERDATABASEstatementwhileDISKREINITisusedtorestoredeviceentriestoappropriatesystemtableswhenthedeviceentrywasmissingfromsysdevices.InSQLServer2000theCREATEDATABASEandALTERDATABASEstatementsallowforthecreationofseparatedataandlogfiles.BothCREATEDATABASEandALTERDATABASEcreateoperatingsystemfilesanddatabasesinasinglestep.ItisthusrecommendedthatallreferencestoDISKINITshouldberemovedinSQLServer2000andreplacedwithreferencestoeitherCREATEDATABASEorALTERDATABASE.

第7题:

You are the administrator of a new multiprocessor SQL Server 2000 computer. You are migrating data from other database management systems to this server. You need to load data from two data files into a new table on the server. The table is empty and has no indexes.

You want to complete the data load as quickly as possible. What should you do? (Each correct answer represents part of the solution. Choose all that apply.)

A.Apply a bulk update lock to the table.

B.Use separate client connections to load the files into the table simultaneously.

C.Create a clustered index on the table.

D.Specify the Full Recovery model for the database.

E.Specify the Bulk-Logged Recovery model for the database.


正确答案:ABE
解析:Explanation:
A: Bulk update locks are taken when bulk copying data into a table and either the TABLOCK hint is specified, or the table lock on bulk load table option is set using sp_tableoption. Bulk update locks allow processes to bulk copy data concurrently into the same table while preventing other processes that are not bulk copying data from accessing the table. In this scenario the bulk update lock would meet the requirement that data should be loaded as quickly as possible.

B: SQL Server 2000 allows data to be bulk copied into a single table from multiple clients in parallel using the bcp utility or BULK INSERT statement. This can improve the performance of data load operations. To bulk copy data into an instance of SQL Server in parallel, the database must be set to Bulk-Logged Recovery, the TABLOCK hint must be specified, and the table must not have any indexes.

E: By specifying the Bulk-Logged Recovery model, the logging for all SELECT INTO, CREATE INDEX, and bulk loading data operations will be minimal and will therefore require less log space while also improving performance.

Incorrect Answers:
C: When data is bulk copied into a single table from multiple clients in parallel using the bcp utility or BULK INSERT statement to improve the performance of data load operations, the database must be set to Bulk-Logged Recovery, the TABLOCK hint must be specified, and the table must not have any indexes.

D: When data is bulk copied into a single table from multiple clients in parallel using the bcp utility or BULK INSERT statement to improve the performance of data load operations, the database must be set to Bulk-Logged Recovery, the TABLOCK hint must be specified, and the table must not have any indexes.

第8题:

You are the administrator of a SQL Server 2000 database named Articles. A large city newspaper uses this database to store its archived newspaper articles. Journalists query the database as part of their research. You have created full-text indexes so that users can query the articles quickly.

A hardware failure forces you to restore the entire database from backup. After you restore the database, the journalists report that they can no longer run queries without receiving errors.

You want to ensure that the journalists can query the database. What should you do?

A.Create a new full-text catalog for the Articles database

B.Rebuild the full-text catalog for the Articles database

C.Create a new full-text index on the table that holds the text for the articles

D.Repopulate the full-text index on the table that holds the text for the articles


正确答案:D
解析:Explanation: Backing up a database does not back up full-text index data in full-text catalogs. The full-text catalog files are not recovered during a Microsoft SQL Server recovery. However, if full-text indexes have been defined for tables, the metadata for the full-text index definitions are stored in the system tables in the database containing the full-text indexes. After a database backup is restored, the full-text index catalogs can be re-created and repopulated.

Note 1:
Setting up a full-text search is a three-step procedure:

1. Make sure that the full-text indexing feature has been installed with your SQL Server.
The full-text index is installed as a service in the system. It would not have to be reinstalled after restoring a database.

2. Create a catalog in the operating system to store the full-text indexes.
A catalog can contain the indexes from one or more tables, and it is treated as a unit for maintenance purposes. In general, you shouldn't need more than one catalog per database.
The catalog is saved outside the database on separate files

3. Before you can implement a full-text search in a given database, you must ensure that the full-text search indexes are populated regularly.
In this scenario we must recreate the index by repopulating the full-text catalog.

Note 2: A SQL Server 2000 full-text index provides support for sophisticated word searches in character string data. The full-text index stores information about significant words and their location within a given column. This information is used to quickly complete full-text queries that search for rows with particular words or combinations of words. The full-text indexes are contained in full-text catalogs. Full-text catalogs and indexes are not stored in the database to which they belong. The catalogs and indexes are managed separately by the Microsoft Search service. Backing up a database does not back up full-text index data in full-text catalogs. However, if full-text indexes have been defined for tables, the meta. data is backed up when a database backup is created.

Incorrect Answers:
A: The catalog already exists. The catalog is stored outside SQL server and would not be affected by the failure and restoration of the database.

B: Rebuildning the full text catalog will not enable the Journalist to run the full-text queries. The catalogs would have to be repopulated as well.

C: The index should be repopulated since it already exists from the backup. There is no need to recreate it.

第9题:

You are planning to import customer data from the Customer table and the Country table in your SQL Server 2000 database into a SQL Server 2005 database. You want to ensure that during the import process,each value in the CountryCode column of the Customer table has a corresponding record in the CountryCode column in the Country table of the SQL Server 2005 database. You define a foreign key between these two tables. Thus,referential integrity will guarantee that the import routine fails if there are any records where a CountryCode value does not exist in the Country table but does exist in the Customer table. You need to ensure that the import process does not fail if records are encountered that do not exist in the Country table. What should you do?()

  • A、Drop the foreign key. Import the data by using the script. Re-create the foreign key.
  • B、Create a CHECK constraint.
  • C、Create a DML INSTEAD OF trigger that writes the failed records to a file or table.
  • D、Create a DML AFTER trigger that writes the failed records to a file or table.

正确答案:C

第10题:

You lost a temporary file that belongs to the default temporary tablespace in your database. From the options provided, which approach would you take to solve the problem? ()

  • A、flash back the database
  • B、import the temporary tablespace from the last export
  • C、restore all the data files and temporary files from the last full database backup and perform a recovery
  • D、not perform a recovery, but create a new temporary tablespace, make it the default temporary tablespace and then drop the old tablespace

正确答案:D

更多相关问题