Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:38:18+00:00 2026-06-10T20:38:18+00:00

I have a database in SQL server 2005 that is called MyStaging and I

  • 0

I have a database in SQL server 2005 that is called MyStaging and I made a blank one called MyStaging_bk. I went to Backup MyStaging and then tried to restore in to MyStaging_bk. But it says I cannot restore since the backup sets are different.

How do I copy db’s and they are on the same database server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:38:20+00:00Added an answer on June 10, 2026 at 8:38 pm

    I’m considering you can log into the sql server with a high level user.

    -- go for master
    use master
    
    -- backup the old database
    backup database olddatabasename
    to disk = 'c:\backup.bak'
    
    -- create a new database
    create database newdatabasename
    on
    (
        name = newdatabasenamedata,
        filename = 'c:\newdatabasenamedata.mdf',
        size = 500mb,
        maxsize = unlimited,
        filegrowth = 25mb
    )
    log on
    (
        name = newdatabasenamelog,
        filename = 'c:\newdatabasenamelog.ldf',
        size = 5mb,
        filegrowth = 5mb
    )
    
    -- put it in single user mode
    alter database newdatabasename
    set single_user
    with rollback immediate
    
    -- get the backup logical names and write it down
    restore filelistonly
    from disk = 'c:\backup.bak'
    
    -- restore the database from the backup using the logical names
    restore database newdatabasename
    from disk = 'c:\backup.bak'
    with
        move 'olddatabasenamelogicalnamedata' to 'c:\newdatabasenamedata.mdf',
        move 'olddatabasenamelogicalnamelog' to 'c:\newdatabasenamelog.ldf',
        replace
    
    -- rename the logical names if you want (do it =p)
    alter database newdatabasename
    modify file
    (
        name = 'olddatabasenamelogicalnamedata',
        newname = 'newdatabasenamedata'
    )
    
    alter database newdatabasename
    modify file
    (
        name = 'olddatabasenamelogicalnamelog',
        newname = 'newdatabasenamelog'
    )
    

    I’m pretty sure that restoring a database from backup automatically puts it in multi user, but:

    alter database newdatabasename
    set multi_user
    

    The newdatabase don’t have any user added to it. So:

    use newdatabasename    
    
    create user someuser from login anexistentloginname
    
    sp_addrolemember 'db_owner', 'someuser'
    sp_addrolemember 'db_datareader', 'someuser' 
    sp_addrolemember 'db_datawriter', 'someuser'
    

    UPDATE1:

    You have to run each block separately or add the go keyword in each block.

    UPDATE2:

    My bad here, the newdatabase will get all users from the backup database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server 2005 database that has been deleted, and I need
I have a junction table in my SQL Server 2005 database that consist of
I have a database table in SQL Server 2005 Express that takes in 2367
we have a portal that have SQL server 2005 database that contain about 1750
I have a SQL Server 2005 database that stores data for multiple users. Each
My general question is, say you have a SQL Server 2005 database that's 20G
I have a sql server 2005 database that I want to setup replication for.
I have a SQL Server 2005 database that I'm trying to access as a
I have a somewhat small database in SQL Server Express 2005 that I really
I have a large (100+ tables) SQL Server 2005 database that I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.