I would like to rename a database progrmatically. if any users are connected
,
this causes an error. is there a way by which i can forcefully close all
connection and restore the database.
Thanks
GSUse this code before restoring/renaming
ALTER DATABASE MYBASE SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
This will restrict the user to the database. NOTE: This will rollback any
uncommitted transactions!
--
Adam J Warne, MCDBA
"GS" wrote:
> I would like to rename a database progrmatically. if any users are connect
ed,
> this causes an error. is there a way by which i can forcefully close all
> connection and restore the database.
> Thanks
> GS|||I have a problem again. I dont want to hardcode my database name ; I would
rather pass this as a parameter to 'ALTER DATABASE' function.
Is this possible
"Adam Warne" wrote:
> Use this code before restoring/renaming
> ALTER DATABASE MYBASE SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
> This will restrict the user to the database. NOTE: This will rollback any
> uncommitted transactions!
> --
> Adam J Warne, MCDBA
>
> "GS" wrote:
>
Monday, March 26, 2012
rename relational DB
Labels:
causes,
connected,
database,
error,
forcefully,
microsoft,
mysql,
oracle,
progrmatically,
relational,
rename,
server,
sql,
users
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment