Rename Database

  • Comments posted to this topic are about the item Rename Database

  • Great start with this thank you for your post! It looks like something that will be very useful to my team.  One thing I wasn't sure of...
    As written how does this sproc handle multiple secondary data files? At first glance, it looks like it doesn't.  Is that right or am I misreading some of the script?

  • Hey Travis, I wasn't thinking about secondary files when I wrote this so you would have to modify it to do so.

  • darren.thompson 95578 - Monday, April 3, 2017 1:18 PM

    Comments posted to this topic are about the item Rename Database

    Hi, that's great script available only for the databases that have 1 data file .MDF and 1 log file .ldf
    Can you modify and add rename task for secondary file .ndf thanks

  • Hi, I tried this stored procedure and it did not work because our system Administrator blocked access to

    procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server.

    Is there any work around?

    Thanks.
    Pete

  • Unfortunately, renaming a database is really a DBA task. This script blurs those lines between a DBA and a developer and some DBA's aren't going to allow it. So, there's not a good work around.

    Having said that, ask your admin if they're willing to set it up as a job with an account that has privileges to run it.
    (Note: This assumes you have access to kick off jobs.)

  • You can capture the output of the script and execute it directly instead of using xp_cmdshell.

  • darren.thompson 95578 - Friday, April 21, 2017 8:04 AM

    Unfortunately, renaming a database is really a DBA task. This script blurs those lines between a DBA and a developer and some DBA's aren't going to allow it. So, there's not a good work around.

    Having said that, ask your admin if they're willing to set it up as a job with an account that has privileges to run it.
    (Note: This assumes you have access to kick off jobs.)

    I was able to by do it by adding a step in front to turn on the cmdshell and turn off at the end.  Thanks

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply