Hi,
I am planning to automate a nighty restore of a DB on another server
can someone point me in the right direction with the SQL script to
modify the logical file names to the correct path and not the ones
carried over with the DB??
i.e the database is to be renamed on the new server
any help much appreciated
Many thanks in advance 14 36839
blueboy wrote:
Hi,
I am planning to automate a nighty restore of a DB on another server
can someone point me in the right direction with the SQL script to
modify the logical file names to the correct path and not the ones
carried over with the DB??
i.e the database is to be renamed on the new server
any help much appreciated
Many thanks in advance
This should point you in the right direction: http://support.microsoft.com/default...b;en-us;314546
If you restore the database to a different file location than the source
database, you must specify the WITH MOVE option. For example, on the
source server the database is in the D:\Mssql\Data folder. The
destination server does not have a D drive, and you want to restore the
database to the C:\Mssql\Data folder.
Good luck
Many thanks for that it seems to be what i was after however i keep
getting an error -
The job failed. The Job was invoked by User domainname\user . The
last step to run was step 2 (Restore). The job was requested to start
at step 1 (Kill connections).
here is the scripting i have;
kill connections -
ALTER DATABASE {db name} SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Restore -
RESTORE DATABASE {db name}
FROM DISK =
'E:\folde\{db name} .bak'
WITH MOVE 'Logical_Name_D ata' TO 'G:\SQLDATA\MSS QL\data\{db name}
_Data.MDF',
MOVE 'Logical_Data_L og' TO 'G:\SQLDATA\MSS QL\data\{db name}
_Log.LDF',
STATS = 1, REPLACE
GO
It stops at step 2 i also notice when i go back into the steps they
are defaulting back to the master database??
Any help much appreciated
blueboy (ma********@hot mail.com) writes:
Many thanks for that it seems to be what i was after however i keep
getting an error -
The job failed. The Job was invoked by User domainname\user . The
last step to run was step 2 (Restore). The job was requested to start
at step 1 (Kill connections).
Did you look under Job history to see what failed? Up to the right
(in Enterprise Manager in SQL 2000), there is a checkbox which says "View
step history". There should be an error message.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
yes the error is
The job failed. The Job was invoked by User domainname\user . The
last step to run was step 2 (Restore). The job was requested to start
at step 1 (Kill connections).
cheers
Arrr Apologies
here is the info
Executed as user: User domainname\user . Exclusive access could not be
obtained because the database is in use. [SQLSTATE 42000] (Error
3101) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000]
(Error 3013). The step failed.
Step one runs fine which disconnects users so not sure what the prob
is? any ideas??
Many thanks
"blueboy" <ma********@hot mail.comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
Arrr Apologies
here is the info
Executed as user: User domainname\user . Exclusive access could not be
obtained because the database is in use. [SQLSTATE 42000] (Error
3101) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000]
(Error 3013). The step failed.
Step one runs fine which disconnects users so not sure what the prob
is? any ideas??
Are you sure the job isn't trying to run while in that DB?
Many thanks
--
Greg Moore
SQL Server DBA Consulting
sql (at) greenms.com http://www.greenms.com
Sorry what do you mean by
Are you sure the job isn't trying to run while in that DB?
appologies for sounding daft its been a long day!!
cheers
blueboy (ma********@hot mail.com) writes:
here is the info
Executed as user: User domainname\user . Exclusive access could not be
obtained because the database is in use. [SQLSTATE 42000] (Error
3101) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000]
(Error 3013). The step failed.
Step one runs fine which disconnects users so not sure what the prob
is? any ideas??
Seems like you set the database for that job step to be the database
you want to restore. Change to master, and you should be fine.
Or someone manages to sneak in betnween the job steps. Make it one
single step to avoid this risk.
(But put SET MULTI_USER in step 2, and on the Advanced tab for step 1,
configure the job to continue with step 2, even if step 1 fails.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pb648174 |
last post by:
Is there a way to rename the logical file names? I'm not talking
specifically about the physical files, because those can be changed
during a restore, but the values immediately to the left of those in
Enterprise Manager such as DBName_Data and DBName_log. Enterprise
Manager lets me change them during a restore, but when I do it gives an...
|
by: MS |
last post by:
I would like to be able to examine a folder, and populate a List Box or
Combo Box with the files that are in it.
How would you go about doing this?
The reason is that I would like the user to be able to restore a list of
tables from specifically selected files that periodically get "backed up"
Cheers!
|
by: Lance |
last post by:
Are there any methods that indicate whether a string can be used as a full path for a file? For example, what I'm looking for is a method that would test for things like correct file name format, invalid characters, total number of characters (to make sure the path is not too long), existing local drive letters, etc. Note that the file does not...
|
by: mikkel |
last post by:
Hi.
I have two physical files on an iSeries (AS/400) box, from which I
would like to make a join logical file.
The files are in a master-detail setup, where the master table
contains:
- CompanyID
- ContractNo
- CustNo
|
by: Lyle Avery |
last post by:
Hi guys,
Who knows how to restore VS 2k5 file associations, I've clicked Tools->General->"Restore File Associations" button but it doesn't work at all. I know Repair the whole product could fix it, but it costs too much time. So, if anyone could fix this issue please tell me asap.
Any suggestions would be appreciated!
Thanks in advance.
| |
by: jaimebienlesfruits |
last post by:
Hi, I'm not quite sure where I should post this, so feel free to direct me. ;) (Have already posted on Apache forum.) Anyway, where do you go and what do you do so that capitalised file names don't matter in the URL. ie. if a visitor types in site.com/FileName.html he can still access the page, even though the page has been saved as...
|
by: bharadwaj |
last post by:
Hi,
If I will rename the logical file name in production will it create any issues.(sql server 2000).
I am getting the problem while restore the production database to other server. So,that I am planning to rename the logical name. The restoration is automated job for all the databases. That restoration script is working fine execpt for 3...
|
by: pradeep c |
last post by:
Currently, I am having a backup file of MSSQL server 2005 database. I want to restore the backup file(of MS Sql server 2005) to MYSQL database.
Please Note: I don't have MS sql server 2005 database.
How can I do it?
|
by: Ormazd |
last post by:
Hello,
I was wondering if anyone might be able to help me with a little PERL script? I'm very new and I have been given a task to write a simple Perl script that prints out the file names and file sizes and determines the average file size from the directory listing found in the "files.txt" file. In other words, I need to add up the size of...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |