AUto-renaming mdf & ldf filenames when restoring a database with SQL Management Studio

Hi!
I am using SQL Management Studio 2014 and I am experiencing some problems when restoring a database backup.
I have a SQL Server 2008R2 & SQL Server 2012 instances.
On the 2012 instance, when I restore a database and rename it into a new name, the mdf and ldf files get automatically renamed into the new database name : Great, this is the behavior that I expect.
On the 2008R2 instance, the mdf and ldf files don't automatically get renamed to match the new database name and I have to perform the renaming manually - pretty annoying.
Has anybody experienced this problem ? If yes, do you know of a fix ?
Thank you
Frederic

Hi,
You are using an external tool (SSMS GUI interface) which give you some behaviors like default names. this is very simple, just use a simple query to restore the database and dont use the GUI if you dont like its behavior
(this behavior might change from time to time). You can use the profiler to make sure what is
the real query that the SSMS sent to the server.
>> How to: Restore a Database to a New Location and Name (Transact-SQL)
http://technet.microsoft.com/en-us/library/ms190447(v=sql.105).aspx
-- use any name that you want in the restore
RESTORE DATABASE MyNewAdvWorks
FROM AdventureWorks2008R2_Backup
WITH RECOVERY,
MOVE 'AdventureWorks2008R2_Data' TO 'D:\MyData\MyNewAdvWorks_Data.mdf',
MOVE 'AdventureWorks2008R2_Log' TO 'F:\MyLog\MyNewAdvWorks_Log.ldf'
GO
  Ronen Ariely
 [Personal Site]    [Blog]    [Facebook]

Similar Messages

  • Auto renaming of the tags when adding new folder

    When I want to add new music to iTunes list, I open the file menu and select "add new folder".
    That way it imports the songs in that folder. The problem is that it renames some the info of albums. Instead of the name of the track, there appears "artist - name of the track". Funny thing is that when I click on "Edit information" it switches back to the correct name.
    But if I add a folder with 500 songs, and I have to click "Edit inforrmation" on half of them to make them use the correct name it isn't funny anymore.
    If the name isn't "corrected" when I sync the iPod, the incorrect names are uploaded.
    Is there any way to correct that and make iTunes use the correct name at once?
    Note that I'm using the spanish version of iTunes and the names of the menus and options are a translation and may not be accurate
    Thanks for your help
    AMD 64   Windows XP   Using spanish version of iTunes

    I noticed something similar:
    If you change tags of a file which is in your iTunes library in another program (e.g. Winamp), you have to edit the file in iTunes afterwards to make these changes "active". It seems that iTunes makes its own database with the tag informations (otherwise everything would be much slower like in Winamp, which is terribly slow with my database of 28.000 mp3-files) and only updates this database when you edit the file.
    I don't know why this happens with newly imported files but a possible solution to your problem which isn't too time consuming would be to select all the newly imported files and right click and edit the information for all of them, change nothing and exit again.
    PC   Windows XP Pro  

  • How to get the filename when parsing a file with d3l

    All
    After some time have experience with interconnect, IStudio I need the following info. Is it possible to get the filename when parsing a flat file using a d3l? This is needed because we need to store the filename together with the data into the database.
    Any examples or directions to some documents are welcome.
    Regards
    Olivier De Groef

    has anyone some info on this

  • When restoring a session with many tabs, how do I stop the tabs from reloading even when I am offline?

    In version 4, when restoring a previous session with many tabs (about 80) in offline mode with no internet connection, the tabs will realise there is no connection and will not load. In version 5, the tabs will constantly try to reload no matter how long the internet connection is not active and as soon as I connect to the internet, all the tabs try to load and will cause huge RAM usage and I have to shut down the browser. I want version 5 to be like 3 and 4 and not try reload all the tabs once it has detected no connection.

    Hello there, lalaysa.
    The following Knowledge Base article offers up some great recommendations for unlinking your old phone number from your device:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone:
    Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages. If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Error while restoring the database in SQL DB.

    When I try to restore Sql backup file for my database in the process of ALM project migration process , but its throwing an error as follow:
    “System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing  database. (Microsoft.SqlServer.Smo)”
    My database in sql server 2008.
    Please let me know the solution and what can be the problem?

    Hi,
    Can you check with the Permissions
    ORA-15055: unable to connect to ASM instanceORA-01031: insufficient privileges>
    Anand

  • Error when opening the database with resetlogs

    ORA-00603: ORACLE SERVER SESSION TERMINATED BY FATAL ERROR
    WHEN I open the database with RESETLOGS

    Well you definitely need to post more information here.
    Looking at what you have posted, all that I can reply is
    ORA-00603: ORACLE server session terminated by fatal error
    Cause: An ORACLE server session is in an unrecoverable state.
    Action: Login to ORACLE again so a new server session will be created

  • Trying to restore a database with RMAN in new server

    Hello,
    Database: Oracle 10gR2
    O/S: Windows Server 2003
    My RMAN backuppieces are stored in a network drive:
    \\old_location\FULL
    and
    \\old_location\INC
    I'm trying to restore a whole database with RMAN in another server from my FULL backup.
    For that, I copy all backuppieces files
    from: \\old_location\FULL
    to new server: D:\new_location\
    Also I created the relevant folder hierarchy under <ORACLE_BASE> directory, as follows:
    a. Create BDUMP, CDUMP, and UDUMP directories under '<ORACLE_ BASE>\admin' directory
    b. Create <DATABASE_NAME> directory under '<ORACLE_BASE>\oradata' directory
    c. pfile.ora and controlfile (CTL_MTDPROD_2308_20120401_1.CTL) are backup from original database and they are in D:\new_location\
    d. I copied pfile.ora and controlfile to folder: C:\oracle\product\10.2.0\db_1\database\
    I started creating an instance in new server from scratch:
    C:\>oradim -new -sid MTDPROD -intpwd mtdprod
    C:\> SET ORACLE_SID=MTDPROD
    C:\> rman
    RMAN> connect target sys
    RMAN> SET DBID=21692876873
    RMAN> STARTUP force nomount PFILE=C:\oracle\product\10.2.0\db_1\database\init_mtdprod.ora
    RMAN> restore controlfile from 'C:\oracle\product\10.2.0\db_1\database\CTL_MTDPROD_2308_20120401_1.CTL';
    RMAN> alter database mount;
    #Since I want to read my backuppieces from D:\new_location and not from \\old_location\FULL then I catalog and restore like:
    RMAN> catalog start with 'D:\new_location\';
    RMAN> restore database;
    Starting recover at 25/04/12
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=541 devtype=DISK
    channel ORA_DISK_1: starting incremental datafile backupset restore
    channel ORA_DISK_1: specifying datafile copies to recover
    recovering datafile copy fno=00003 name=D:\BD_MTDPROD\CONTROLFILES\SYSAUX01.DBF
    recovering datafile copy fno=00004 name=D:\BD_MTDPROD\CONTROLFILES\USERS01.DBF
    recovering datafile copy fno=00007 name=D:\BD_MTDPROD\DATAFILES_DATA\MSE.ORA
    recovering datafile copy fno=00010 name=D:\BD_MTDPROD\DATAFILES_DATA\EXPEDIENTES2.ORA
    channel ORA_DISK_1: reading from backup piece \\old_location\FULL\FULL_MTDPROD_20120401_2304_1.BAK
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: failover to piece handle=D:\new_location\FULL\FULL_MTDPROD_20120401_2304_1.BAK tag=TAG20120401T190004
    .....(continues)
    Questions:
    1. RMAN still reads from old_location. The only way to avoid that would be deleting all files from \\old_location\FULL ?
    2. The message "failover to piece handle=D:\new_location\...." indicates that that file is not usefull? I just copy them from old_location to new_location... how can they get useless?
    I suspect there is something in controlfile that redirects to \\old_location\FULL\ and doesn't let to read from D:\new_location\
    Please, advice.

    user521219 wrote:
    Questions:
    1. RMAN still reads from old_location. The only way to avoid that would be deleting all files from \\old_location\FULL ?
    2. The message "failover to piece handle=D:\new_location\...." indicates that that file is not usefull? I just copy them from old_location to new_location... how can they get useless?
    I suspect there is something in controlfile that redirects to \\old_location\FULL\ and doesn't let to read from D:\new_location\Is this a cold backup? Did you change the location of control file in your PFILE or is it still pointing to old location?
    You may want to check the output of RESTORE DATABASE PREVIEW command, which will just report which backup files it uses without actually restoring thhe DB.

  • Issue when connecting to database from SQL Developer tool

    Hi,
    I was trying to connect to a remote oracle database 10.2.0.5 (hosted at window 2008 R2 server) from my local SQL Developer tool.
    When setting up connection in SQL Developer tool, I was able to connect to the database by selecting TNS (Network Allias).
    However, it does not work when I choose Basic type with the same information (HOST, PORT, SID).
    What is the difference between TNS and Basic setting option? Please advise and assist.
    Thanks.
    Regards,
    Jia

    Hi JimSmith,
    Thanks for reply.
    TNS entry as below:
    ORCL_DB =
    (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 91.198.252.83)(PORT = 1521)) )
    (CONNECT_DATA = (SID = orcl) (SERVER = DEDICATED) ) )
    It works fine if I choose TNS (Network Allias: ORCL_DB).
    For the Basic setting:
    Hostname = 91.198.252.83
    Port = 1521
    SID = orcl
    The error I received when connecting to db based on Basic option is Failure -Io exception: The Network Adapter could not establish the connection.
    Below are the entries of SQLnet.ora. Any entry should I add into sqlnet.ora?
    SQLNET.AUTHENTICATION_SERVICES= (NONE)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    Appreciate your comment.
    Thanks.
    Regards,
    Jia

  • Lost contacts when restoring new phone with old phones back up?

    I have just bought a new lap top and I have transferred all my files over to it. I backed up my I phone 3gs and then restored my new I phone 4gs with the back up. Everything went well except my contacts and apps are not on my new 4gs? Mail settings, old text messages pictures etc all there? Where can I find them?
    The second problem I had is I downloaded the latest software on my I phone 4 it has lost all my contacts after finishing the download? Where have they gone?

    If your contacts are still on your 3GS download the free app My Contacts backup on your 3GS.  It will back up your contacts and an email attachment.  Send this email to yourself and open it on your 4S.  Tap the attachment to import your contacts to your 4S.  Don't know what to tell you about your iPhone 4; your contacts there are probably gone.  If they are the same as the ones on your 3GS, open the same email and import your contacts on your iPhone 4.

  • Error when creating a database on SQL Server 2012(Virtual Machine)

    Hi,
    I create a virtual machine on VMWare Workstation 10, then install Windows 7(32bit), then install SQL Server 2012 Enterprise version.
    Then I write a Visual C++2008 program and using ADO to connect to the local SQL Server, with the connection string below:
    “Provider=sqloledb;Data Source=(local);Integrated Security=SSPI;”
    The connect succeed, then I try to create a new SQL Server database by calling:
    m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘E:\\MyDatabase.mdf’)”), NULL, 0);
    where E: is a USB drive plugged in.
    When running the above statement, I can even see the MyDatabase.mdf file is being created, but finally get an error and error number is 80040e31 when checking the error from m_pConnection, after analyzing the com exception, we find it reports the error as
    “IDispath error #3121”. Both errors seem to indicate a “Timeout error”.
    Then I try to create the database on the local drive in the virtual machine, as follows:
    m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘C:\\MyDatabase.mdf’)”), NULL, 0);
    Then I get error number: 80040e14 from m_pConnection, and com error is “IDispath error #3092”
    What is the problem?
    Thanks

    Hello chcw,
    SQL Server 2012 Enterprise doesn't support to install on Windows 7 Opeating System. For detail information, please refer to the article below:
    The article shows the operating system requirements for the principal editions of SQL Server 2012:
    http://msdn.microsoft.com/en-us/library/ms143506.aspx#top_principal
    Here is an article for your reference, please see:
    How To  Create a SQL Server Database Programmatically by Using ADO.NET and Visual C# .NET:
    https://support.microsoft.com/kb/307283/en-us
    If you have any feedback on our support, please click
    here.
    Regards,
    Elvis Long
    TechNet Community Support

  • Restore a Database with Differential

    Hello All,
    I'm new to this forum after read a few question error it given me little bit more understanding. But here's my problem I was create a database implement some tables than make a 'Full Backup' and input information on the table before make a 'Differential Backup'.  I don't want restore a full database and just want to recovery specific table were deleted or removed.  Please help........
    Message show error:
    Restore failed for Server 'SALES18'. (Microsoft.SqlServer.Smo)
    Additional information:
    System.Data.SqlClient.SqlError: The log or differential backup cannot be restored because no files are ready to rollforward.
    Thank you very much.

    SQL Server Writer service  When running, Database Engine locks and has exclusive access to the data files and also put a entry in "backup" table of MSDB databse which update the First and last  LSN number against each database instance on MS SQL server.So the differentails backup becomes invalid becuase it seeks its full backup thru LSN number.
    SO you get this messages so SQL Server Writer service should shutdown during wohle day so that it could not become invalid ur differential backup.
    example :
                       your first backup thru SQL backup utility
                       DatabaseName                     First LSN      LastLSN
                       AAA_Database                     000012345   000012346
    Differentail Backup off AAA_database
                        DatabaseName                     First LSN      LastLSN
                       AAA_Database                     000012347  000012348
    your NTbackup utulity is running and SP2 of SQL and windows server has installed
                      DatabaseName                     First LSN      LastLSN
                       AAA_Database                     000012349  000012340
    when urestore Differenail backup then u got the message deescribed  in this thread. Because sql server detects that a latest full backup has done.
    Solution is only shutdown ur SQL Writer Service.
     

  • When connecting to database in SQL* plus giving Error

    hi,
    I am using Oracle 10g. My problem is when i connecting to database in Server through SQL * Plus giving the Error:
    ORA-12514: TNS:listerner does not currently know of service requested in connect descriptor.
    Why this is happening i don't know. I created listener also. But no use. How to solve this can any tell me pls... ! .
    Thank u...!

    hi,
    Thank u bang for u r reply. It is not working sir. I added the listener as follows:
    # listener.ora Network Configuration File: D:\oracle10g\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = HA14)(PORT = 1521))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle10g)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    I typed the following commands in command prompts
    C:\>lsnrctl
    LSNRCTL for 32-bit Windows: Version 10.1.0.2.0 - Production on 30-MAY-2007 16:29
    :14
    Copyright (c) 1991, 2004, Oracle. All rights reserved.
    Welcome to LSNRCTL, type "help" for information.
    LSNRCTL> stop
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    The command completed successfully
    LSNRCTL> start
    Starting tnslsnr: please wait...
    TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Production
    System parameter file is D:\oracle10g\network\admin\listener.ora
    Log messages written to D:\oracle10g\network\log\listener.log
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Produ
    ction
    Start Date 30-MAY-2007 16:29:28
    Uptime 0 days 0 hr. 0 min. 2 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File D:\oracle10g\network\admin\listener.ora
    Listener Log File D:\oracle10g\network\log\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    same error is getting as i am getting previously. Tell me solution pls....!
    Thank u...!

  • Error when connecting to database from connection manager

    New installation of JDeveloper 11r2.
    java.lang.NullPointerException
         at oracle.dms.context.DMSContextManager.getContext(DMSContextManager.java:437)
         at oracle.dms.context.ExecutionContext.get(ExecutionContext.java:445)
         at oracle.dms.context.ExecutionContext.get(ExecutionContext.java:492)
         at oracle.dms.instrument.Noun.<init>(Noun.java:188)
         at oracle.dms.instrument.Noun.create(Noun.java:275)
         at oracle.dms.instrument.NounFactory.create(NounFactory.java:66)
         at oracle.jdbc.driver.DMSFactory.createNoun(DMSFactory.java:69)
         at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:2253)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:617)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:54)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:413)
         at oracle.jdeveloper.db.adapter.AbstractConnectionCreator.getConnection(AbstractConnectionCreator.java:117)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:174)
         at oracle.jdeveloper.db.adapter.DatabaseProvider.getConnection(DatabaseProvider.java:143)
         at oracle.jdevimpl.db.adapter.CADatabaseFactory.createConnectionImpl(CADatabaseFactory.java:44)
         at oracle.javatools.db.DatabaseFactory.createConnection(DatabaseFactory.java:352)
         at oracle.javatools.db.DatabaseFactory.createDatabase(DatabaseFactory.java:148)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:504)
         at oracle.jdeveloper.db.DatabaseConnections.getDatabase(DatabaseConnections.java:440)
         at oracle.dbtools.raptor.utils.Connections$ConnectionInfo$ConnectRunnable.doWork(Connections.java:1051)
         at oracle.ide.dialogs.ProgressRunnable.run(ProgressRunnable.java:156)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:612)
         at java.lang.Thread.run(Thread.java:595)
    Occurs with both thin and oci8 connections.
    Any ideas?
    Conection name: tryit
    Connection type: Oracle (JDBC)
    username: me
    password: mine
    save password: ticked
    Driver: thin (also tried oci8)
    Host Name: myhost
    SID: my10gdb (also tried service name).

    yes, when we install oracle 8i in windows professionel we have this problem, before installing 8i we connected to the database without problem
    thank you

  • Runtime Error when trying to connect with Media manager

    Whenever I try to connect to the Media manager with Blackberry Desktop manager, I get "Runtime Error"!
    It says: "Program:C:\Program Files\Roxio\MediaManager 9\MediaManager9.exe"  Then it says "This application has requested the Runtime to termnate it in an unusual way.  Please contact the application's support team for more information." 
    I seached and learned it might be that roxio is not running and to enable it going through the Start menu "msconfig".....it shows roxio "stopped" but also enabled. 
    Help! What next?  This didn't begin happening until I followed a prompt telling me to update! 

    dear JLK, I must agree with herb: 'google is your friend'.
    To give you a few pointers:
    - The nmap output shows no 3389/tcp open, which means you will not be able to use the terminal server on that host, even if it where active.
    - Check if the windows host you are trying to reach has a terminal server running (which is the windows server component which is responsible for serving remote desktop connectons), or has windows desktop sharing enabled (which is the windows client/non server variant responsible for serving remote desktop connections)
    - Check if the windows host your are trying to reach has a firewall of some sort (the windows embedded one, or a 3rd party one) enabled.
    - Also, can other machines use remote desktop on that machine?

  • Uninstall sql2005 when side-by-side with sql 2008r2 and sql2012

    Hi
    We have a large server with sql 2005, sql2008 r2 and sql2012 installed side-by side.
    We no longer use 2005 and would like to remove it from the server, is this safe to do on a standard uninstall or can it have a detrimental affect on the 2008 and 2012 installations?

    Please refer to below support article
    http://support.microsoft.com/kb/909967
    Please remove using Command prompt.
    How to uninstall using command prompt
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

Maybe you are looking for