Thursday, March 29, 2012
Attach norecovery database
where the target database is in norecovery mode for continuous log files.
If we detach the database while it is in norecovery mode, could we attach
the database back in norecovery mode. I tried it and it turned into
recovery mode with few transactions rollback while detach. Thanks!
When you detach a db it rolls back any open trans so the answer is no. You
can attach it but it it will already have been put into recovery.
Andrew J. Kelly SQL MVP
"Kevin" <Kevin@.noemail.com> wrote in message
news:OWajj3qmEHA.1288@.TK2MSFTNGP10.phx.gbl...
> Is there a way to attach a database to norecovery mode? We have a 2nd
site
> where the target database is in norecovery mode for continuous log files.
> If we detach the database while it is in norecovery mode, could we attach
> the database back in norecovery mode. I tried it and it turned into
> recovery mode with few transactions rollback while detach. Thanks!
>
>
Attach norecovery database
where the target database is in norecovery mode for continuous log files.
If we detach the database while it is in norecovery mode, could we attach
the database back in norecovery mode. I tried it and it turned into
recovery mode with few transactions rollback while detach. Thanks!When you detach a db it rolls back any open trans so the answer is no. You
can attach it but it it will already have been put into recovery.
--
Andrew J. Kelly SQL MVP
"Kevin" <Kevin@.noemail.com> wrote in message
news:OWajj3qmEHA.1288@.TK2MSFTNGP10.phx.gbl...
> Is there a way to attach a database to norecovery mode? We have a 2nd
site
> where the target database is in norecovery mode for continuous log files.
> If we detach the database while it is in norecovery mode, could we attach
> the database back in norecovery mode. I tried it and it turned into
> recovery mode with few transactions rollback while detach. Thanks!
>
>sql
attach files to new box
Is there a way to attach the files of a db to a newly
created box? No backups as these are QA db's not
production.
TIA, ChrisR
"ChrisR" <anonymous@.discussions.microsoft.com> wrote in message
news:c6fe01c48a03$56389420$a401280a@.phx.gbl...
> sql2k sp3
> Is there a way to attach the files of a db to a newly
> created box? No backups as these are QA db's not
> production.
Assuming that these files are now in use by SQL Server there are several
methods. You can detach the database, copy the *.mdf & *.ldf file to the new
server and reattach the files. Or, use the BACKUP command, then RESTORE on
your target server.
The following reference covers your options fairly well:
http://support.microsoft.com/default...b;en-us;314546
Steve
attach files to new box
Is there a way to attach the files of a db to a newly
created box? No backups as these are QA db's not
production.
TIA, ChrisR"ChrisR" <anonymous@.discussions.microsoft.com> wrote in message
news:c6fe01c48a03$56389420$a401280a@.phx.gbl...
> sql2k sp3
> Is there a way to attach the files of a db to a newly
> created box? No backups as these are QA db's not
> production.
Assuming that these files are now in use by SQL Server there are several
methods. You can detach the database, copy the *.mdf & *.ldf file to the new
server and reattach the files. Or, use the BACKUP command, then RESTORE on
your target server.
The following reference covers your options fairly well:
http://support.microsoft.com/defaul...kb;en-us;314546
Steve
attach files to new box
Is there a way to attach the files of a db to a newly
created box? No backups as these are QA db's not
production.
TIA, ChrisR"ChrisR" <anonymous@.discussions.microsoft.com> wrote in message
news:c6fe01c48a03$56389420$a401280a@.phx.gbl...
> sql2k sp3
> Is there a way to attach the files of a db to a newly
> created box? No backups as these are QA db's not
> production.
Assuming that these files are now in use by SQL Server there are several
methods. You can detach the database, copy the *.mdf & *.ldf file to the new
server and reattach the files. Or, use the BACKUP command, then RESTORE on
your target server.
The following reference covers your options fairly well:
http://support.microsoft.com/default.aspx?scid=kb;en-us;314546
Steve
Attach failed
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.
Your drive L: is not part of the clustered SQL group. Either place the file
on a clustered drive on which SQL Server is a dependent, or make the L:
drive a dependency.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
..
"J Pacquiao" <JPacquiao@.discussions.microsoft.com> wrote in message
news:E1DE2C43-8554-402E-9699-27865351614D@.microsoft.com...
I moved the files to free-up some space and now when I try to attach the
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.
sql
Attach failed
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.Your drive L: is not part of the clustered SQL group. Either place the file
on a clustered drive on which SQL Server is a dependent, or make the L:
drive a dependency.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"J Pacquiao" <JPacquiao@.discussions.microsoft.com> wrote in message
news:E1DE2C43-8554-402E-9699-27865351614D@.microsoft.com...
I moved the files to free-up some space and now when I try to attach the
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.
Attach failed
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.Your drive L: is not part of the clustered SQL group. Either place the file
on a clustered drive on which SQL Server is a dependent, or make the L:
drive a dependency.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"J Pacquiao" <JPacquiao@.discussions.microsoft.com> wrote in message
news:E1DE2C43-8554-402E-9699-27865351614D@.microsoft.com...
I moved the files to free-up some space and now when I try to attach the
files I am getting this error. How do you troubleshoot this and what is the
caused of it?
Thank you.
Server: Msg 5184, Level 16, State 2, Line 1
Cannot use file 'L:\mssql\data\InterDTA_Data' for clustered server.
Only formatted files on which the cluster resource of the server has a
dependency can be used.
attach detach db
files and reattaching db again to cause login problems later. if yes why?Not sure I understand the question but the answer is most likely in one of
these:
http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
http://www.databasejournal.com/features/mssql/article.php/3379901 Moving
system DB's
http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
to a New Location with Detach/Attach
http://support.microsoft.com/?id=221465 Using WITH MOVE in a
Restore
http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
Passwords Between SQL Servers
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
users
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
Restoring a .mdf
--
Andrew J. Kelly SQL MVP
"Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
> Is it possible detaching one db coping under/ different names /master and
> lof
> files and reattaching db again to cause login problems later. if yes why?
>|||Hi,
If you are attaching the database with different name in same server, you
will never get any Login issue. If you are attaching into
a different server then you have syncronize the Logins and users using the
system procedure SP_CHANGE_USERS_LOGIN (see Books online)
Thanks
Hari
SQL Server MVP
"Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
> Is it possible detaching one db coping under/ different names /master and
> lof
> files and reattaching db again to cause login problems later. if yes why?
>|||Hi Hary,
thanks for your reply. Let me try to explain the situation I am in. I had to
make copy for training purposes of a production db. I detached prod db and
copied mdf and ldf in the same data directory but with names test.mdf and
test.ldf. Then I attached our prod db and new test db. During attaching I had
to choose dbowner (domain admin). It seemed to me that i saved time using
this teqniche. But later users reported that they couldnt log in prod and
test db via the application (its in citrix). After short phone talk with
vendors they explained that detaching and attaching caused dbo alias
deleting. They have app login that use dbo alias. I ran sp_addalias 'app,
'dbo' and everithing looks fine with prod db. But its impossible to use test
db. Users that are in sys admin group dont have problem but ordinary users
that connect to applications db via app user cannot login at all. I wonder
whats the problem? all ordinary users are stored in users table in prod db
and have encrypted passwords. app user password is encrypted and stored in
different db.
i will be dismissed : )
"Hari Prasad" wrote:
> Hi,
> If you are attaching the database with different name in same server, you
> will never get any Login issue. If you are attaching into
> a different server then you have syncronize the Logins and users using the
> system procedure SP_CHANGE_USERS_LOGIN (see Books online)
> Thanks
> Hari
> SQL Server MVP
>
> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
> news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
> > Is it possible detaching one db coping under/ different names /master and
> > lof
> > files and reattaching db again to cause login problems later. if yes why?
> >
>
>|||Hi Hary,
thanks for your reply. Let me try to explain the situation I am in. I had to
make copy for training purposes of a production db. I detached prod db and
copied mdf and ldf in the same data directory but with names test.mdf and
test.ldf. Then I attached our prod db and new test db. During attaching I had
to choose dbowner (domain admin). It seemed to me that i saved time using
this teqniche. But later users reported that they couldnt log in prod and
test db via the application (its in citrix). After short phone talk with
vendors they explained that detaching and attaching caused dbo alias
deleting. They have app login that use dbo alias. I ran sp_addalias 'app,
'dbo' and everithing looks fine with prod db. But its impossible to use test
db. Users that are in sys admin group dont have problem but ordinary users
that connect to applications db via app user cannot login at all. I wonder
whats the problem? all ordinary users are stored in users table in prod db
and have encrypted passwords. app user password is encrypted and stored in
different db.
i will be dismissed : )
"Andrew J. Kelly" wrote:
> Not sure I understand the question but the answer is most likely in one of
> these:
>
> http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
> http://www.databasejournal.com/features/mssql/article.php/3379901 Moving
> system DB's
> http://www.support.microsoft.com/?id=314546 Moving DB's between Servers
> http://www.support.microsoft.com/?id=224071 Moving SQL Server Databases
> to a New Location with Detach/Attach
> http://support.microsoft.com/?id=221465 Using WITH MOVE in a
> Restore
> http://www.support.microsoft.com/?id=246133 How To Transfer Logins and
> Passwords Between SQL Servers
> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
> Restore
> http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
> users
> http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
> Errors After Restoring Dump
> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
> Issues When a Database Is Moved Between SQL Servers
> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
> Restoring a .mdf
> --
> Andrew J. Kelly SQL MVP
>
> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
> news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
> > Is it possible detaching one db coping under/ different names /master and
> > lof
> > files and reattaching db again to cause login problems later. if yes why?
> >
>
>|||Then you should look at the links I posted. In particular this first one
should be most helpful:
http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
Restore
http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
Errors After Restoring Dump
http://www.support.microsoft.com/?id=240872 How to Resolve Permission
Issues When a Database Is Moved Between SQL Servers
--
Andrew J. Kelly SQL MVP
"Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
news:62CB085D-5980-4776-8A35-DEAC178F2AEB@.microsoft.com...
> Hi Hary,
> thanks for your reply. Let me try to explain the situation I am in. I had
> to
> make copy for training purposes of a production db. I detached prod db and
> copied mdf and ldf in the same data directory but with names test.mdf and
> test.ldf. Then I attached our prod db and new test db. During attaching I
> had
> to choose dbowner (domain admin). It seemed to me that i saved time using
> this teqniche. But later users reported that they couldnt log in prod and
> test db via the application (its in citrix). After short phone talk with
> vendors they explained that detaching and attaching caused dbo alias
> deleting. They have app login that use dbo alias. I ran sp_addalias 'app,
> 'dbo' and everithing looks fine with prod db. But its impossible to use
> test
> db. Users that are in sys admin group dont have problem but ordinary users
> that connect to applications db via app user cannot login at all. I wonder
> whats the problem? all ordinary users are stored in users table in prod db
> and have encrypted passwords. app user password is encrypted and stored in
> different db.
> i will be dismissed : )
>
> "Andrew J. Kelly" wrote:
>> Not sure I understand the question but the answer is most likely in one
>> of
>> these:
>>
>> http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
>> http://www.databasejournal.com/features/mssql/article.php/3379901
>> Moving
>> system DB's
>> http://www.support.microsoft.com/?id=314546 Moving DB's between
>> Servers
>> http://www.support.microsoft.com/?id=224071 Moving SQL Server
>> Databases
>> to a New Location with Detach/Attach
>> http://support.microsoft.com/?id=221465 Using WITH MOVE in a
>> Restore
>> http://www.support.microsoft.com/?id=246133 How To Transfer Logins
>> and
>> Passwords Between SQL Servers
>> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs
>> after a
>> Restore
>> http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
>> users
>> http://www.support.microsoft.com/?id=168001 User Logon and/or
>> Permission
>> Errors After Restoring Dump
>> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
>> Issues When a Database Is Moved Between SQL Servers
>> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
>> Restoring a .mdf
>> --
>> Andrew J. Kelly SQL MVP
>>
>> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
>> news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
>> > Is it possible detaching one db coping under/ different names /master
>> > and
>> > lof
>> > files and reattaching db again to cause login problems later. if yes
>> > why?
>> >
>>|||Thanx : ) I hope this will help. Just curios if EE could have the same login
problems. May be will be better to upgrade to EE
"Andrew J. Kelly" wrote:
> Then you should look at the links I posted. In particular this first one
> should be most helpful:
> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs after a
> Restore
> http://www.support.microsoft.com/?id=168001 User Logon and/or Permission
> Errors After Restoring Dump
> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
> Issues When a Database Is Moved Between SQL Servers
> --
> Andrew J. Kelly SQL MVP
>
> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
> news:62CB085D-5980-4776-8A35-DEAC178F2AEB@.microsoft.com...
> > Hi Hary,
> > thanks for your reply. Let me try to explain the situation I am in. I had
> > to
> > make copy for training purposes of a production db. I detached prod db and
> > copied mdf and ldf in the same data directory but with names test.mdf and
> > test.ldf. Then I attached our prod db and new test db. During attaching I
> > had
> > to choose dbowner (domain admin). It seemed to me that i saved time using
> > this teqniche. But later users reported that they couldnt log in prod and
> > test db via the application (its in citrix). After short phone talk with
> > vendors they explained that detaching and attaching caused dbo alias
> > deleting. They have app login that use dbo alias. I ran sp_addalias 'app,
> > 'dbo' and everithing looks fine with prod db. But its impossible to use
> > test
> > db. Users that are in sys admin group dont have problem but ordinary users
> > that connect to applications db via app user cannot login at all. I wonder
> > whats the problem? all ordinary users are stored in users table in prod db
> > and have encrypted passwords. app user password is encrypted and stored in
> > different db.
> >
> > i will be dismissed : )
> >
> >
> >
> > "Andrew J. Kelly" wrote:
> >
> >> Not sure I understand the question but the answer is most likely in one
> >> of
> >> these:
> >>
> >>
> >> http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
> >> http://www.databasejournal.com/features/mssql/article.php/3379901
> >> Moving
> >> system DB's
> >> http://www.support.microsoft.com/?id=314546 Moving DB's between
> >> Servers
> >> http://www.support.microsoft.com/?id=224071 Moving SQL Server
> >> Databases
> >> to a New Location with Detach/Attach
> >> http://support.microsoft.com/?id=221465 Using WITH MOVE in a
> >> Restore
> >> http://www.support.microsoft.com/?id=246133 How To Transfer Logins
> >> and
> >> Passwords Between SQL Servers
> >> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs
> >> after a
> >> Restore
> >> http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins to
> >> users
> >> http://www.support.microsoft.com/?id=168001 User Logon and/or
> >> Permission
> >> Errors After Restoring Dump
> >> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
> >> Issues When a Database Is Moved Between SQL Servers
> >> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
> >> Restoring a .mdf
> >>
> >> --
> >> Andrew J. Kelly SQL MVP
> >>
> >>
> >> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
> >> news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
> >> > Is it possible detaching one db coping under/ different names /master
> >> > and
> >> > lof
> >> > files and reattaching db again to cause login problems later. if yes
> >> > why?
> >> >
> >>
> >>
> >>
>
>|||It would be the same for any edition.
--
Andrew J. Kelly SQL MVP
"Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
news:B7FD797D-F1DB-41E4-B6D4-0BDA27B27153@.microsoft.com...
> Thanx : ) I hope this will help. Just curios if EE could have the same
> login
> problems. May be will be better to upgrade to EE
> "Andrew J. Kelly" wrote:
>> Then you should look at the links I posted. In particular this first one
>> should be most helpful:
>> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs
>> after a
>> Restore
>> http://www.support.microsoft.com/?id=168001 User Logon and/or
>> Permission
>> Errors After Restoring Dump
>> http://www.support.microsoft.com/?id=240872 How to Resolve Permission
>> Issues When a Database Is Moved Between SQL Servers
>> --
>> Andrew J. Kelly SQL MVP
>>
>> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
>> news:62CB085D-5980-4776-8A35-DEAC178F2AEB@.microsoft.com...
>> > Hi Hary,
>> > thanks for your reply. Let me try to explain the situation I am in. I
>> > had
>> > to
>> > make copy for training purposes of a production db. I detached prod db
>> > and
>> > copied mdf and ldf in the same data directory but with names test.mdf
>> > and
>> > test.ldf. Then I attached our prod db and new test db. During attaching
>> > I
>> > had
>> > to choose dbowner (domain admin). It seemed to me that i saved time
>> > using
>> > this teqniche. But later users reported that they couldnt log in prod
>> > and
>> > test db via the application (its in citrix). After short phone talk
>> > with
>> > vendors they explained that detaching and attaching caused dbo alias
>> > deleting. They have app login that use dbo alias. I ran sp_addalias
>> > 'app,
>> > 'dbo' and everithing looks fine with prod db. But its impossible to use
>> > test
>> > db. Users that are in sys admin group dont have problem but ordinary
>> > users
>> > that connect to applications db via app user cannot login at all. I
>> > wonder
>> > whats the problem? all ordinary users are stored in users table in prod
>> > db
>> > and have encrypted passwords. app user password is encrypted and stored
>> > in
>> > different db.
>> >
>> > i will be dismissed : )
>> >
>> >
>> >
>> > "Andrew J. Kelly" wrote:
>> >
>> >> Not sure I understand the question but the answer is most likely in
>> >> one
>> >> of
>> >> these:
>> >>
>> >>
>> >> http://vyaskn.tripod.com/moving_sql_server.htm Moving DBs
>> >> http://www.databasejournal.com/features/mssql/article.php/3379901
>> >> Moving
>> >> system DB's
>> >> http://www.support.microsoft.com/?id=314546 Moving DB's between
>> >> Servers
>> >> http://www.support.microsoft.com/?id=224071 Moving SQL Server
>> >> Databases
>> >> to a New Location with Detach/Attach
>> >> http://support.microsoft.com/?id=221465 Using WITH MOVE in
>> >> a
>> >> Restore
>> >> http://www.support.microsoft.com/?id=246133 How To Transfer Logins
>> >> and
>> >> Passwords Between SQL Servers
>> >> http://www.support.microsoft.com/?id=298897 Mapping Logins & SIDs
>> >> after a
>> >> Restore
>> >> http://www.dbmaint.com/SyncSqlLogins.asp Utility to map logins
>> >> to
>> >> users
>> >> http://www.support.microsoft.com/?id=168001 User Logon and/or
>> >> Permission
>> >> Errors After Restoring Dump
>> >> http://www.support.microsoft.com/?id=240872 How to Resolve
>> >> Permission
>> >> Issues When a Database Is Moved Between SQL Servers
>> >> http://www.sqlservercentral.com/scripts/scriptdetails.asp?scriptid=599
>> >> Restoring a .mdf
>> >>
>> >> --
>> >> Andrew J. Kelly SQL MVP
>> >>
>> >>
>> >> "Eli Milkova" <EliMilkova@.discussions.microsoft.com> wrote in message
>> >> news:8BD9FBF7-6420-49C7-8B3F-25E0774BA43B@.microsoft.com...
>> >> > Is it possible detaching one db coping under/ different names
>> >> > /master
>> >> > and
>> >> > lof
>> >> > files and reattaching db again to cause login problems later. if yes
>> >> > why?
>> >> >
>> >>
>> >>
>> >>
>>sql
Attach DB Without Transaction Logs
Hi, there,
I have multiple transaction log files. I don't need the transaction logs and intended to remove them. I have tried detaching the database, rename the logs and trying to re-attach the database without the logs but to no avail. The error message mentioned something like file activation failed and SQL couldn't rebuild the transaction logs.
Is there a way to get rid of the transaction log files?
Thank you.
Regards,
Yong Hwee
Hi,
you can use sp_attach_single_file_db but it works only on databases that have a single log file.
When sp_attach_single_file_db attaches the database to the server, it builds a new log file. If the database is read-only, the log file is built in its previous location.
...
OR by reading this thread attaching DB without .ldf file ?
CU
tosc
|||Hi, Tosc,
Thank you for your immediate reply. It seems like there is no workaround for database with multiple log files.
Regards,
Yong Hwee
|||There are lot of limitation with sp_attach_single_file_db. The database should not have morethan one LOG and Datafile and the database should be properly detached. So in your case this process will not do. You requirement is to remove the Secondary LOG File, if am correct. What you can do is, Remove the secondary log file first using
DBCC SHRINKFILE (,EMPTYFILE)
alter database test remove file .
Then you can trucate the primary log file to any size you want. Please take backup of the database before starting anything
Madhu
Refer : http://madhuottapalam.blogspot.com/search?q=Transaction+Log
Madhu
|||In SQL Server 2005 you can you use CREATE DATABASE syntax to rebuild the log. The ATTACH_REBUILD_LOG syntax should work even if there are multiple log files.
|||Hi, there,
Thank you for your reply. I managed to delete the log by first backup with option to truncate log after which I change the database to simple recovery. I can delete the logs this way.
Thank you.
Regards,
Yong Hwee
Attach Db With Same Files As Existing Db
The only problem is they have the same file names, so when I try to attach the copy I get an error message. Is there any way to change the name of the data file and log file that a database points to so that I can attach it to my Server?
Thanks in advance for your help!Look up RESTORE DATABASE in Books Online. You need to use the WITH MOVE option.
RESTORE DATABASE database
WITH
MOVE 'logical data file' TO 'somenewfile.mdf',
MOVE 'logical log file' TO 'somenewfile.ldf'
You can find the name of the files by using: RESTORE FILELISTONLY FROM DISK = 'file.bak'
Tuesday, March 27, 2012
Attach db from installer (only read mode)
Hi,
I have made setup of my program,
I need to attach a db to the server. To do this:
- Copy mdf and ldf files into default data folder of instance of sqlexpress
- run scrip from custom action in the installer that:
a. attach the db
b. create login
c. create user for login in db
There is a problem...I run script slq file by sqlcmd and launch it from a c# process.
The rusult is that the db was attacched but in only read mode, and the point c not work.
If I execute manually the same script sql with sqlcmd in dos window, it work without problem in all point: a,b and c
What are the reason of this?
I think that start process in c# not work correctly....this is the code:
process = new Process();
process.StartInfo.FileName = "sqlcmd.exe";
process.StartInfo.Arguments = commandLine;
process.Start();
process.WaitForExit();
help me, plese!
thanks in advance
andrea
SInce you have posted this in Express forum, i strongly feel that you should use SQL Server Express User Instance feature. Its nothing but Embedded Database.
Refer this.
http://blogs.msdn.com/sqlexpress/archive/2006/11/22/connecting-to-sql-express-user-instances-in-management-studio.aspx
Madhu
attach db
copied the files to serverB. I want to change the file names when I attach
it on serverB. How can I do this? If I try to change the name and attach
the db, it doesn't like the renamed files; it will only let me attach as the
original name of the files.
If it's not available in attach, can I rename the file once I attach them
somehow?
Thanks, AndreI figured this out, thanks.
"Andre" <no@.spam.com> wrote in message
news:uvackOWzGHA.1536@.TK2MSFTNGP02.phx.gbl...
> I'm moving a db from serverA to serverB. I detached the db on serverA and
> copied the files to serverB. I want to change the file names when I
attach
> it on serverB. How can I do this? If I try to change the name and attach
> the db, it doesn't like the renamed files; it will only let me attach as
the
> original name of the files.
> If it's not available in attach, can I rename the file once I attach them
> somehow?
>
> Thanks, Andre
>
attach db
copied the files to serverB. I want to change the file names when I attach
it on serverB. How can I do this? If I try to change the name and attach
the db, it doesn't like the renamed files; it will only let me attach as the
original name of the files.
If it's not available in attach, can I rename the file once I attach them
somehow?
Thanks, AndreI figured this out, thanks.
"Andre" <no@.spam.com> wrote in message
news:uvackOWzGHA.1536@.TK2MSFTNGP02.phx.gbl...
> I'm moving a db from serverA to serverB. I detached the db on serverA and
> copied the files to serverB. I want to change the file names when I
attach
> it on serverB. How can I do this? If I try to change the name and attach
> the db, it doesn't like the renamed files; it will only let me attach as
the
> original name of the files.
> If it's not available in attach, can I rename the file once I attach them
> somehow?
>
> Thanks, Andre
>
attach databases without detaching
guaranteed that i can always attach the db even if they are not successfully
detached
The only ways i know of a successful attach are if the databases are
detached successfully and if SQL is gracefully shut down.
There are so many 3rd party tools that replicate these files asynchronously
or have these files mirrored on a bit level,etc... and then they just stop
the replication or mirroring and claim they can attach it... Will this work
all the time ?
Or lets put it this way... Under what conditions will attach not work even
if i have all the relevant data and log files
If SQL Server has been shut down and the files copied or they were dettached
properly there shouldn't be too much of a problem. But if they simply
attempt to copy the files while SQL Server is running there is not telling
what they will get.
Andrew J. Kelly SQL MVP
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>
|||If you did not detach the database, there is no guarantee that an attach
will always work, even if you shut down the database and copy the data and
log files.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>
|||echoing Andy and Peter, if you have multiple log files for a single DB it is
almost guranteed that an attach will not work without a prior detach.
"Peter Yeoh" wrote:
> If you did not detach the database, there is no guarantee that an attach
> will always work, even if you shut down the database and copy the data and
> log files.
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> successfully
> asynchronously
> work
>
>
sql
attach databases without detaching
guaranteed that i can always attach the db even if they are not successfully
detached
The only ways i know of a successful attach are if the databases are
detached successfully and if SQL is gracefully shut down.
There are so many 3rd party tools that replicate these files asynchronously
or have these files mirrored on a bit level,etc... and then they just stop
the replication or mirroring and claim they can attach it... Will this work
all the time ?
Or lets put it this way... Under what conditions will attach not work even
if i have all the relevant data and log filesIf SQL Server has been shut down and the files copied or they were dettached
properly there shouldn't be too much of a problem. But if they simply
attempt to copy the files while SQL Server is running there is not telling
what they will get.
--
Andrew J. Kelly SQL MVP
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>|||If you did not detach the database, there is no guarantee that an attach
will always work, even if you shut down the database and copy the data and
log files.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>|||echoing Andy and Peter, if you have multiple log files for a single DB it is
almost guranteed that an attach will not work without a prior detach.
"Peter Yeoh" wrote:
> If you did not detach the database, there is no guarantee that an attach
> will always work, even if you shut down the database and copy the data and
> log files.
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> > If i have all the mdf and ldf files that comprise of a database, is it
> > guaranteed that i can always attach the db even if they are not
> successfully
> > detached
> >
> > The only ways i know of a successful attach are if the databases are
> > detached successfully and if SQL is gracefully shut down.
> >
> > There are so many 3rd party tools that replicate these files
> asynchronously
> > or have these files mirrored on a bit level,etc... and then they just stop
> > the replication or mirroring and claim they can attach it... Will this
> work
> > all the time ?
> >
> > Or lets put it this way... Under what conditions will attach not work even
> > if i have all the relevant data and log files
> >
> >
>
>
attach databases without detaching
guaranteed that i can always attach the db even if they are not successfully
detached
The only ways i know of a successful attach are if the databases are
detached successfully and if SQL is gracefully shut down.
There are so many 3rd party tools that replicate these files asynchronously
or have these files mirrored on a bit level,etc... and then they just stop
the replication or mirroring and claim they can attach it... Will this work
all the time ?
Or lets put it this way... Under what conditions will attach not work even
if i have all the relevant data and log filesIf SQL Server has been shut down and the files copied or they were dettached
properly there shouldn't be too much of a problem. But if they simply
attempt to copy the files while SQL Server is running there is not telling
what they will get.
Andrew J. Kelly SQL MVP
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>|||If you did not detach the database, there is no guarantee that an attach
will always work, even if you shut down the database and copy the data and
log files.
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
"Hassan" <fatima_ja@.hotmail.com> wrote in message
news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> If i have all the mdf and ldf files that comprise of a database, is it
> guaranteed that i can always attach the db even if they are not
successfully
> detached
> The only ways i know of a successful attach are if the databases are
> detached successfully and if SQL is gracefully shut down.
> There are so many 3rd party tools that replicate these files
asynchronously
> or have these files mirrored on a bit level,etc... and then they just stop
> the replication or mirroring and claim they can attach it... Will this
work
> all the time ?
> Or lets put it this way... Under what conditions will attach not work even
> if i have all the relevant data and log files
>|||echoing Andy and Peter, if you have multiple log files for a single DB it is
almost guranteed that an attach will not work without a prior detach.
"Peter Yeoh" wrote:
> If you did not detach the database, there is no guarantee that an attach
> will always work, even if you shut down the database and copy the data and
> log files.
> Peter Yeoh
> http://www.yohz.com
> Need smaller SQL2K backup files? Use MiniSQLBackup Lite, free!
>
> "Hassan" <fatima_ja@.hotmail.com> wrote in message
> news:O1NLrfIkEHA.384@.TK2MSFTNGP10.phx.gbl...
> successfully
> asynchronously
> work
>
>
Attach database problem
I have got database files from sql server 2000 which i'm trying to attach to sql server 2005 database. During the attach process, I'm getting the following erros:
EXEC sp_attach_db @.dbname = N'Dev',
@.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
@.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
Msg 601, Level 12, State 3, Line 1
Could not continue scan with NOLOCK due to data movement.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Dev'. CREATE DATABASE is aborted.
Any idea what this refers to?
Regards,
D2
This usually happens with DML operations. I'm guessing you retried the operation a few times and they all failed with the same error. Can you attach this database back to SQL Server 2000?
Another thing you can try is to run SQL Server in console mode with traceflag 3630:
Start->Run->cmd->Enter
cd "%ProgramFiles%\Microsoft SQL Server\<instance_name>\mssql\binn"
sqlservr.exe -c -T3630
Then try to attach the database again and watch for this message on the console:
spid <id> ex_raise <nn>:<nn> (sev=<nn>,state=<nn>), called from 0x<nnnnnnnn>
This is the error original error which caused 601. Cut&Paste that line here and that will give us more information. <nn>:<nn> will be the error number, e.g. 6:01 -> error 601
Thanks,
Fabricio.
Attach database problem
I am a newbie trying to attach an MSDE dbf from a whatever.mdf and
whatever.ldf files. I keep getting an error that I can't attach the database
to the same name as an existing database.
Any help would be appreciated?
Danny
Hello,
Looks like the database name you specify in the atatch database is already
in the same server instance. Execute SP_HELPDB and make sure that
the database you specy is already not there.
Thanks
Hari
"Danny" <lane.dj@.gmail.com> wrote in message
news:OZdKYqZaHHA.1220@.TK2MSFTNGP03.phx.gbl...
> Hi Folks
> I am a newbie trying to attach an MSDE dbf from a whatever.mdf and
> whatever.ldf files. I keep getting an error that I can't attach the
> database to the same name as an existing database.
> Any help would be appreciated?
> Danny
>
attach database issue
I have got database files from sql server 2000 which i'm trying to
attach to sql server 2005 database. During the attach process, I'm
getting the following erros:
EXEC sp_attach_db @.dbname = N'Dev',
@.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
@.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
Msg 601, Level 12, State 3, Line 1
Could not continue scan with NOLOCK due to data movement.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Dev'. CREATE DATABASE is aborted.
Any idea what this refers to?
Regards,
D2
D2,
How about trying to do same thing in SSMS attach menu?
and I found similar SQL in BOL :
CREATE DATABASE pubs ON PRIMARY
(FILENAME =
'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\pubs.mdf')
LOG ON (FILENAME =
'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\Data\pubs_log.ldf')
FOR ATTACH;
GO
try it

+--
Kenial.GhostOnNetwork.
D2 wrote:
> Hi,
> I have got database files from sql server 2000 which i'm trying to
> attach to sql server 2005 database. During the attach process, I'm
> getting the following erros:
> EXEC sp_attach_db @.dbname = N'Dev',
> @.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
> @.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
>
> Msg 601, Level 12, State 3, Line 1
> Could not continue scan with NOLOCK due to data movement.
> Msg 1813, Level 16, State 2, Line 1
> Could not open new database 'Dev'. CREATE DATABASE is aborted.
> Any idea what this refers to?
> Regards,
> D2
>
|||D2
This example I took from the BOL. Try it .
USE master;
GO
sp_detach_db Archive;
GO
-- Get the SQL Server data path
DECLARE @.data_path nvarchar(256);
SET @.data_path = (SELECT SUBSTRING(physical_name, 1,
CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
FROM master.sys.master_files
WHERE database_id = 1 AND file_id = 1);
-- Execute CREATE DATABASE FOR ATTACH statement
EXEC ('CREATE DATABASE Archive
ON (FILENAME = '''+ @.data_path + 'archdat1.mdf'')
FOR ATTACH');
GO
"D2" <dhapola@.yahoo.com> wrote in message
news:1182324219.833398.13530@.q19g2000prn.googlegro ups.com...
> Hi,
> I have got database files from sql server 2000 which i'm trying to
> attach to sql server 2005 database. During the attach process, I'm
> getting the following erros:
> EXEC sp_attach_db @.dbname = N'Dev',
> @.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
> @.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
>
> Msg 601, Level 12, State 3, Line 1
> Could not continue scan with NOLOCK due to data movement.
> Msg 1813, Level 16, State 2, Line 1
> Could not open new database 'Dev'. CREATE DATABASE is aborted.
> Any idea what this refers to?
> Regards,
> D2
>
|||Tried the attach from menu before writing queries :-)
thanks for your time.
On Jun 20, 2:04 pm, Kenial <ken...@.shinbiro.com.korea> wrote:[vbcol=seagreen]
> D2,
> How about trying to do same thing in SSMS attach menu?
> and I found similar SQL in BOL :
> CREATE DATABASE pubs ON PRIMARY
> (FILENAME =
> 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\pubs.mdf')
> LOG ON (FILENAME =
> 'C:\Program Files\Microsoft SQL
> Server\MSSQL.1\MSSQL\Data\pubs_log.ldf')
> FOR ATTACH;
> GO
> try it

> +--
> Kenial.GhostOnNetwork.
> D2 wrote:
>
>
|||Already tried that; BOL query is only trying to dynamically attach the
folder path.
sp_attach_db sp is internally executing the same query.
thanks for your time.
On Jun 20, 2:03 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:[vbcol=seagreen]
> D2
> This example I took from the BOL. Try it .
> USE master;
> GO
> sp_detach_db Archive;
> GO
> -- Get the SQL Server data path
> DECLARE @.data_path nvarchar(256);
> SET @.data_path = (SELECT SUBSTRING(physical_name, 1,
> CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
> FROM master.sys.master_files
> WHERE database_id = 1 AND file_id = 1);
> -- Execute CREATE DATABASE FOR ATTACH statement
> EXEC ('CREATE DATABASE Archive
> ON (FILENAME = '''+ @.data_path + 'archdat1.mdf'')
> FOR ATTACH');
> GO"D2" <dhap...@.yahoo.com> wrote in message
> news:1182324219.833398.13530@.q19g2000prn.googlegro ups.com...
>
>
>
|||D2
Do you have any open transactions? Any other actvities while the attach
process is running?
"D2" <dhapola@.yahoo.com> wrote in message
news:1182332774.416879.280860@.j4g2000prf.googlegro ups.com...
> Already tried that; BOL query is only trying to dynamically attach the
> folder path.
> sp_attach_db sp is internally executing the same query.
> thanks for your time.
> On Jun 20, 2:03 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:
>
|||On this particular database: no. i'm trying to attach these files to a
new database.
However the same sql server instance is hosting many other databases,
in any of those there may be open transaction.
On Jun 20, 3:29 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:[vbcol=seagreen]
> D2
> Do you have any open transactions? Any other actvities while the attach
> process is running?
> "D2" <dhap...@.yahoo.com> wrote in message
> news:1182332774.416879.280860@.j4g2000prf.googlegro ups.com...
>
>
>
>
>
|||D2
Are you saying that you created a new database called 'Dev' and then run the
following script?
EXEC sp_attach_db @.dbname = N'Dev',
@.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
@.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
sp_attach_db is depricated by MS and will be removed in the future.
I used CREATE DATABASE ...FOR ATTCH option and it worked just fine.
Try moving those files to another location and try execute.
"D2" <dhapola@.yahoo.com> wrote in message
news:1182336562.364728.71990@.i13g2000prf.googlegro ups.com...
> On this particular database: no. i'm trying to attach these files to a
> new database.
> However the same sql server instance is hosting many other databases,
> in any of those there may be open transaction.
> On Jun 20, 3:29 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:
>
|||No. What I mean is.. while executing these sql statements, a new
database called Dev is being created having filegroups set to the mdf
and ldf files ginve in the filename parameters.
I have done attach/detach many times.. both by writng query and using
ssdm menus. Only this time I'm getting some problem.
On Jun 20, 4:22 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:[vbcol=seagreen]
> D2
> Are you saying that you created a new database called 'Dev' and then run the
> following script?
> EXEC sp_attach_db @.dbname = N'Dev',
> @.filename1 = N'F:\SQL2005\Data\LAWSONDatabase\DEV.MDF',
> @.filename2 = N'F:\SQL2005\Data\LAWSONDatabase\Dev_log.LDF';
> sp_attach_db is depricated by MS and will be removed in the future.
> I used CREATE DATABASE ...FOR ATTCH option and it worked just fine.
> Try moving those files to another location and try execute.
> "D2" <dhap...@.yahoo.com> wrote in message
> news:1182336562.364728.71990@.i13g2000prf.googlegro ups.com...
>
>
>
>
>
>
>
>
|||D2
Okay, do you have a backup of the database. Try using RESTORE coomand
instead of attaching the files.
"D2" <dhapola@.yahoo.com> wrote in message
news:1182342259.453149.68560@.i38g2000prf.googlegro ups.com...
> No. What I mean is.. while executing these sql statements, a new
> database called Dev is being created having filegroups set to the mdf
> and ldf files ginve in the filename parameters.
> I have done attach/detach many times.. both by writng query and using
> ssdm menus. Only this time I'm getting some problem.
> On Jun 20, 4:22 pm, "Uri Dimant" <u...@.iscar.co.il> wrote:
>