Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2895

Re: Run-away connections!

$
0
0

Thinking on this a little more, there is a variation of dbcc dbreboot that will resolve the problem easily because you are just trying to load a dump.  It will just take a very small addition to your batch file.

 

Presumably your batch job already has some logic in it to kill any regular user connections currently active in the database.  This will do the same thing, but also handles cases where the dbtkeep counter is off.

 

You can use
dbcc dbreboot("shutdown_load", <dbname>)
to kill any current processes in the database (just the database, not the whole server) and reboots the database, placing it in a "for load" state.  The database can't be used by a process, but a dump can be loaded into it.

 

Example:

1> set switch on 3604

2> go

Switch 3604 ('print_output_to_client') is turned on.

All supplied switches are successfully turned on.

1> dbcc dbreboot("shutdown_load", test)

2> go

---------- Shutting Down Database 'test' ----------

---------- Operation on Database 'test' Completed Successfully ----------

1> use test

2> go

Msg 930, Level 14, State 1:

Server 'rel1572sp130_bret_sun2', Line 1:

Database 'test' cannot be opened because either an earlier system termination

left LOAD DATABASE incomplete or the database is created with 'for load' option.

Load the database or contact a user with System Administrator (SA) role.

1> load database test from "/work/test.dmp"

2> go

Backup Server session id is: 12. Use this value when executing the

'sp_volchanged' system stored procedure after fulfilling any volume change

request from the Backup Server.

Backup Server: 6.28.1.1: Dumpfile name 'test153090D1FE   ' section number 1

mounted on disk file '/work/test.dmp'

Backup Server: 4.188.1.1: Database test: 2760 kilobytes (13%) LOADED.

Backup Server: 4.188.1.1: Database test: 20486 kilobytes (100%) LOADED.

Backup Server: 4.188.1.1: Database test: 20496 kilobytes (100%) LOADED.

Backup Server: 3.42.1.1: LOAD is complete (database test).

Caution:  You have set up this database to include space on disk 2 for both data

and the transaction log.  This can make recovery impossible if that disk fails.

Started estimating recovery log boundaries for database 'test'.

Database 'test', checkpoint=(2625, 1), first=(2625, 1), last=(2625, 14).

Completed estimating recovery log boundaries for database 'test'.

Started ANALYSIS pass for database 'test'.

Completed ANALYSIS pass for database 'test'.

Started REDO pass for database 'test'. The total number of log records to

process is 14.

Redo pass of recovery has processed 1 committed and 0 aborted transactions.

Completed REDO pass for database 'test'.

Use the ONLINE DATABASE command to bring this database online; ASE will not

bring it online automatically.

 

-bret


Viewing all articles
Browse latest Browse all 2895

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>