Home > database >  What a great god know how to delete the data in the used configuration manager
What a great god know how to delete the data in the used configuration manager

Time:10-10

Who is a great god know is essentially how to delete the data in the configuration manager

CodePudding user response:

This is contract database file to change the 665 to 0 close a few times more without change

CodePudding user response:

I know this, delete command? Or the need to manually to delete?

CodePudding user response:

To delete? What terrier, delete the DB directly?

CodePudding user response:

Non-business library operation is not frequently, don't log, changing the database to a simple model, and then to collect the log file

CodePudding user response:

Shrinkage and delete the DB
 
USE [Test]
GO
DBCC SHRINKDATABASE (N 'Test')
GO

DBCC SHRINKFILE (N 'test_log' 0, TRUNCATEONLY)
GO
The DROP DATABASE [Test]

/* - pay special attention to 

Please follow the steps, not for the previous steps, please don't step back
Or you may damage the database.


Generally not recommended to do 4, 6 2
Step 4 is not safe, may damage the database or data loss
After step 6 if log to upper limit, the database processing will fail, can be restored after clear the log.
- */

- all the library name below means you have to deal with the database of library name

1. Clear the log (SQL2000 available)
DUMP the TRANSACTION identification WITH NO_LOG

2. Truncate the transaction log:
BACKUP the LOG identification WITH NO_LOG

3. The contract database files (if not compression, the database file will not reduce the
Enterprise manager - right click you to compress the database - all tasks - database - contraction file
- select a log file, in the way choice in contraction to XXM, here will give a allow contraction to the smallest number M, directly input the number, it is ok to determine
- select data file - in the way choice in contraction to XXM, here will give a allow contraction to the smallest number M, directly input the number, it is ok to determine

SQL statements can also be used to complete the
- contract database
DBCC SHRINKDATABASE (library)

-- contract specifies the data file, one is the file number, may through the query statement: select * from sysfiles
DBCC SHRINKFILE (1)

4. In order to maximize the narrowing of the log file (if it is SQL 7.0, this step can only be done in query analyzer)
A. separation database:
Enterprise manager - - right - separate database server - database

B. delete the LOG file in my computer

C. additional database:
Enterprise manager - additional database server - database - right -

This method will generate a new LOG size only over 500 K

Or use the code:
The following sample separation, pubs, and then attach a file of pubs to current server,

A. separation
The EXEC sp_detach_db @ dbname='library'

B. delete log files

C. to additional
The EXEC sp_attach_single_file_db @ dbname='library',
@ physname='c: \ Program Files \ Microsoft SQL Server \ MSSQL \ Data \ library name. MDF'

5. In order to automatically after contraction, do the following Settings:
Enterprise manager - right server - database - property - options - "automatic contraction"

- SQL statement set mode:
EXEC sp_dboption 'library', 'autoshrink', 'TRUE'

6. If you want to don't make it too big log growth after
Enterprise manager - right server - database - property - the transaction log
- limit file growth for xM (x is you allow maximum data file size)

Setup method - SQL statement:
The alter database library name modify the file (file name=logic, maxsize=20)
  • Related