I need a script or method to lock users out of a database,
shrink it/truncated it and then let them back in....You can try:
ALTER DATABASE SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
This will set the database to dbo_useonly and roll back all current
transactions.
--
Carlos E. Rojas
SQL Server MVP
Co-Author SQL Server 2000 Programming by Example
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
> I need a script or method to lock users out of a database,
> shrink it/truncated it and then let them back in....|||Hi,
use the below steps in script
1. ALTER DATABASE PUBS SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
2. If it full recovery model Execute , Backup Log command (To backup
transaction log)
3. Execute DBCC SHRINKFILE on Transaction log file
4. ALTER DATABASE PUBS SET MULTI_USER
Thanks
Hari
MCDBA
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
> I need a script or method to lock users out of a database,
> shrink it/truncated it and then let them back in....
Showing posts with label truncated. Show all posts
Showing posts with label truncated. Show all posts
Friday, March 23, 2012
lock database and shrink database log
I need a script or method to lock users out of a database,
shrink it/truncated it and then let them back in....You can try:
ALTER DATABASE SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
This will set the database to dbo_useonly and roll back all current
transactions.
Carlos E. Rojas
SQL Server MVP
Co-Author SQL Server 2000 programming by Example
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
use the below steps in script
1. ALTER DATABASE PUBS SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
2. If it full recovery model Execute , Backup Log command (To backup
transaction log)
3. Execute DBCC SHRINKFILE on Transaction log file
4. ALTER DATABASE PUBS SET MULTI_USER
Thanks
Hari
MCDBA
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
shrink it/truncated it and then let them back in....You can try:
ALTER DATABASE SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
This will set the database to dbo_useonly and roll back all current
transactions.
Carlos E. Rojas
SQL Server MVP
Co-Author SQL Server 2000 programming by Example
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
quote:|||Hi,
> I need a script or method to lock users out of a database,
> shrink it/truncated it and then let them back in....
use the below steps in script
1. ALTER DATABASE PUBS SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
2. If it full recovery model Execute , Backup Log command (To backup
transaction log)
3. Execute DBCC SHRINKFILE on Transaction log file
4. ALTER DATABASE PUBS SET MULTI_USER
Thanks
Hari
MCDBA
"Jamie Elliott" <jelliott@.alexlee.com> wrote in message
news:966501c3eb21$82ec2cb0$a101280a@.phx.gbl...
quote:
> I need a script or method to lock users out of a database,
> shrink it/truncated it and then let them back in....
Subscribe to:
Posts (Atom)