Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to rename a database

Author  Topic 

mathmax
Yak Posting Veteran

95 Posts

Posted - 2006-10-03 : 12:58:10
Hello,

I would like to know how to rename a database. I use SQL manager to access it.

Thank you in advance for your help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-03 : 13:02:00
You can rename a database with sp_renamedb. Check SQL Server Books Online for details of it.

Tara Kizer
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2006-10-03 : 15:30:19
I've some problems with the script.
I've written this :
EXEC sp_dboption 'MA_BASE', 'single user', 'TRUE' --passe en mono-utilisateur
go
EXEC sp_renamedb 'MA_BASE', 'MA_NEW_BASE' go
EXEC sp_dboption 'MA_NEW_BASE', 'single user', 'FALSE' --passe en multi-utilisateur
go
When I try to execute it, I get this message : "Inavalid authorization".

Do you know what is my problem ?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-03 : 15:34:19
Are you sysadmin?

Tara Kizer
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2006-10-03 : 15:46:14
I don't know. What should I do to be sysadmin ?
Go to Top of Page

Luis Martin
Yak Posting Veteran

54 Posts

Posted - 2006-10-03 : 16:50:11
Because to do those kind of things you have to be sysadmin.
Go to Top of Page

dewacorp.alliances

452 Posts

Posted - 2006-10-03 : 17:06:32
quote:
Originally posted by mathmax

I don't know. What should I do to be sysadmin ?



I guess you only have access as databaseowner .... you may need to ask DBAs to the run the script for you.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-03 : 18:28:01
mathmax, are you connecting as the sa account or is there a DBA there that can assist you?

Tara Kizer
Go to Top of Page

mathmax
Yak Posting Veteran

95 Posts

Posted - 2006-10-04 : 13:39:55
Ok, thank you for your help. In fact, I'm sysadmin but I've to be connected to a database to execute the script. I had tried to connect to the database I want to rename but it didn't work. So I have connected myself to an other database and it works.
Go to Top of Page
   

- Advertisement -