Showing posts with label scheduled. Show all posts
Showing posts with label scheduled. Show all posts

Thursday, March 8, 2012

Automated restore of a user database

I am trying to restore a user database in a scheduled Job I created that executes the following command "restore database sqleligibilitydatabase from disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%.bak'". I get an error 3101 "unable to get exclusive use".
Absolutely no one is on this server when I do this
From which database are you executing the restore command? Make sure it is the master database. you can run an
sp_who just before and get the output from the jobstep to a file and examine that file to see who is using the
database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that executes the following command
"restore database sqleligibilitydatabase from disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%.bak'". I get an
error 3101 "unable to get exclusive use". Absolutely no one is on this server when I do this
|||Hi,
Turn the database to single user before restore and make it multiuser after
restore:-
Change the script to do below :-
Alter database <dbname> set single_user with rollback immediate
go
restore database dbname from disk=...........
go
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that
executes the following command "restore database sqleligibilitydatabase from
disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%.bak'". I get an error 3101
"unable to get exclusive use". Absolutely no one is on this server when I
do this
|||ALTER DATABASE sqleligibilitydatabase SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE sqleligibilitydatabase SET ONLINE
RESTORE DATABASE......
That will clear all users out of the database. Also, make sure your job
step does not execute in the context of the target database.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that
executes the following command "restore database sqleligibilitydatabase from
disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%.bak'". I get an error 3101
"unable to get exclusive use". Absolutely no one is on this server when I
do this

Automated restore of a user database

I am trying to restore a user database in a scheduled Job I created that exe
cutes the following command "restore database sqleligibilitydatabase from di
sk= 'd:\dbfrom01\sqleligibilitydatabase_db_%
.bak'". I get an error 3101 "un
able to get exclusive use".
Absolutely no one is on this server when I do thisFrom which database are you executing the restore command? Make sure it is t
he master database. you can run an
sp_who just before and get the output from the jobstep to a file and examine
that file to see who is using the
database.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that executes
the following command
"restore database sqleligibilitydatabase from disk= 'd:\dbfrom01\sqleligibil
itydatabase_db_%.bak'". I get an
error 3101 "unable to get exclusive use". Absolutely no one is on this serv
er when I do this|||Hi,
Turn the database to single user before restore and make it multiuser after
restore:-
Change the script to do below :-
Alter database <dbname> set single_user with rollback immediate
go
restore database dbname from disk=...........
go
Alter database <dbname> set multi_user
Thanks
Hari
MCDBA
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that
executes the following command "restore database sqleligibilitydatabase from
disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%
.bak'". I get an error 3101
"unable to get exclusive use". Absolutely no one is on this server when I
do this|||ALTER DATABASE sqleligibilitydatabase SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE sqleligibilitydatabase SET ONLINE
RESTORE DATABASE......
That will clear all users out of the database. Also, make sure your job
step does not execute in the context of the target database.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"cbriscoejr" <cbriscoejr@.discussions.microsoft.com> wrote in message
news:C9D0496B-0E92-48B2-A3EE-860048654DE4@.microsoft.com...
> I am trying to restore a user database in a scheduled Job I created that
executes the following command "restore database sqleligibilitydatabase from
disk= 'd:\dbfrom01\sqleligibilitydatabase_db_%
.bak'". I get an error 3101
"unable to get exclusive use". Absolutely no one is on this server when I
do this

Wednesday, March 7, 2012

Automated backup failing

I keepp getting the following error in my application log for SQL Server 2000:
SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
'DB Maintenance Plan master, msdb, model''
(0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
Does anyone know what this means?
--
John SchusterSpecify a report file for the plan and check that file for detailed information about errors,. My
guess is that you try to do log backups for databases that are in simple recovery mode. Also, you
can't do log backup for master even if you set it to full recovery (master is special).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
>I keepp getting the following error in my application log for SQL Server 2000:
> SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
> 'DB Maintenance Plan master, msdb, model''
> (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
> 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
> Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
> Does anyone know what this means?
> --
> John Schuster|||Tibor,
Thank you very much. I will try doing what you suggest.
--
John Schuster
"Tibor Karaszi" wrote:
> Specify a report file for the plan and check that file for detailed information about errors,. My
> guess is that you try to do log backups for databases that are in simple recovery mode. Also, you
> can't do log backup for master even if you set it to full recovery (master is special).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
> >I keepp getting the following error in my application log for SQL Server 2000:
> >
> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
> > 'DB Maintenance Plan master, msdb, model''
> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
> >
> > Does anyone know what this means?
> > --
> >
> > John Schuster
>|||I do have reporting set up. This is the message I see for the maintenance
plan in question:
Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server
'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
Starting maintenance plan 'DB Maintenance Plan master, msdb, model' on
9/27/2007 12:00:06 AM
Backup can not be performed on database 'master'. This sub task is ignored.
[1] Database model: Transaction Log Backup...
Destination: [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
** Execution Time: 0 hrs, 0 mins, 1 secs **
[2] Database model: Verifying Backup...
** Execution Time: 0 hrs, 0 mins, 1 secs **
Backup can not be performed on database 'msdb'. This sub task is ignored.
Deleting old text reports... 1 file(s) deleted.
End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
9/27/2007 12:00:06 AM
SQLMAINT.EXE Process Exit Code: 1 (Failed)
--
John Schuster
"Tibor Karaszi" wrote:
> Specify a report file for the plan and check that file for detailed information about errors,. My
> guess is that you try to do log backups for databases that are in simple recovery mode. Also, you
> can't do log backup for master even if you set it to full recovery (master is special).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
> >I keepp getting the following error in my application log for SQL Server 2000:
> >
> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
> > 'DB Maintenance Plan master, msdb, model''
> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
> >
> > Does anyone know what this means?
> > --
> >
> > John Schuster
>|||Yep, as I suspected. You can't do log backups on databases that are in simple recovery model.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
>I do have reporting set up. This is the message I see for the maintenance
> plan in question:
> Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server
> 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
> Starting maintenance plan 'DB Maintenance Plan master, msdb, model' on
> 9/27/2007 12:00:06 AM
> Backup can not be performed on database 'master'. This sub task is ignored.
> [1] Database model: Transaction Log Backup...
> Destination: [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
> ** Execution Time: 0 hrs, 0 mins, 1 secs **
> [2] Database model: Verifying Backup...
> ** Execution Time: 0 hrs, 0 mins, 1 secs **
> Backup can not be performed on database 'msdb'. This sub task is ignored.
> Deleting old text reports... 1 file(s) deleted.
> End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
> 9/27/2007 12:00:06 AM
> SQLMAINT.EXE Process Exit Code: 1 (Failed)
> --
> John Schuster
>
> "Tibor Karaszi" wrote:
>> Specify a report file for the plan and check that file for detailed information about errors,. My
>> guess is that you try to do log backups for databases that are in simple recovery mode. Also, you
>> can't do log backup for master even if you set it to full recovery (master is special).
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
>> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
>> >I keepp getting the following error in my application log for SQL Server 2000:
>> >
>> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
>> > 'DB Maintenance Plan master, msdb, model''
>> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
>> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
>> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
>> >
>> > Does anyone know what this means?
>> > --
>> >
>> > John Schuster|||Tibor,
How, then, do I back up the master and msdb databases? Is it possible?
--
John Schuster
"Tibor Karaszi" wrote:
> Yep, as I suspected. You can't do log backups on databases that are in simple recovery model.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
> >I do have reporting set up. This is the message I see for the maintenance
> > plan in question:
> >
> > Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server
> > 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
> > Starting maintenance plan 'DB Maintenance Plan master, msdb, model' on
> > 9/27/2007 12:00:06 AM
> > Backup can not be performed on database 'master'. This sub task is ignored.
> >
> > [1] Database model: Transaction Log Backup...
> > Destination: [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
> >
> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >
> > [2] Database model: Verifying Backup...
> >
> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >
> > Backup can not be performed on database 'msdb'. This sub task is ignored.
> >
> > Deleting old text reports... 1 file(s) deleted.
> >
> > End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
> > 9/27/2007 12:00:06 AM
> > SQLMAINT.EXE Process Exit Code: 1 (Failed)
> > --
> > John Schuster
> >
> >
> > "Tibor Karaszi" wrote:
> >
> >> Specify a report file for the plan and check that file for detailed information about errors,. My
> >> guess is that you try to do log backups for databases that are in simple recovery mode. Also, you
> >> can't do log backup for master even if you set it to full recovery (master is special).
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://sqlblog.com/blogs/tibor_karaszi
> >>
> >>
> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> >> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
> >> >I keepp getting the following error in my application log for SQL Server 2000:
> >> >
> >> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB Maintenance Plan
> >> > 'DB Maintenance Plan master, msdb, model''
> >> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
> >> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked by
> >> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
> >> >
> >> > Does anyone know what this means?
> >> > --
> >> >
> >> > John Schuster
> >>
>|||John,
You can only perform the Full backup, don't check for the Transaction log
backups.
Chris
"John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
news:0B25B6FF-9A71-4F34-9B23-D77090551424@.microsoft.com...
> Tibor,
> How, then, do I back up the master and msdb databases? Is it possible?
> --
> John Schuster
>
> "Tibor Karaszi" wrote:
>> Yep, as I suspected. You can't do log backups on databases that are in
>> simple recovery model.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
>> news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
>> >I do have reporting set up. This is the message I see for the
>> >maintenance
>> > plan in question:
>> >
>> > Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
>> > Server
>> > 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
>> > Starting maintenance plan 'DB Maintenance Plan master, msdb, model' on
>> > 9/27/2007 12:00:06 AM
>> > Backup can not be performed on database 'master'. This sub task is
>> > ignored.
>> >
>> > [1] Database model: Transaction Log Backup...
>> > Destination: [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
>> >
>> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
>> >
>> > [2] Database model: Verifying Backup...
>> >
>> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
>> >
>> > Backup can not be performed on database 'msdb'. This sub task is
>> > ignored.
>> >
>> > Deleting old text reports... 1 file(s) deleted.
>> >
>> > End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
>> > 9/27/2007 12:00:06 AM
>> > SQLMAINT.EXE Process Exit Code: 1 (Failed)
>> > --
>> > John Schuster
>> >
>> >
>> > "Tibor Karaszi" wrote:
>> >
>> >> Specify a report file for the plan and check that file for detailed
>> >> information about errors,. My
>> >> guess is that you try to do log backups for databases that are in
>> >> simple recovery mode. Also, you
>> >> can't do log backup for master even if you set it to full recovery
>> >> (master is special).
>> >>
>> >> --
>> >> Tibor Karaszi, SQL Server MVP
>> >> http://www.karaszi.com/sqlserver/default.asp
>> >> http://sqlblog.com/blogs/tibor_karaszi
>> >>
>> >>
>> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
>> >> message
>> >> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
>> >> >I keepp getting the following error in my application log for SQL
>> >> >Server 2000:
>> >> >
>> >> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB
>> >> > Maintenance Plan
>> >> > 'DB Maintenance Plan master, msdb, model''
>> >> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
>> >> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked
>> >> > by
>> >> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
>> >> >
>> >> > Does anyone know what this means?
>> >> > --
>> >> >
>> >> > John Schuster
>> >>|||Thank you.
--
John Schuster
"Chris Wood" wrote:
> John,
> You can only perform the Full backup, don't check for the Transaction log
> backups.
> Chris
> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> news:0B25B6FF-9A71-4F34-9B23-D77090551424@.microsoft.com...
> > Tibor,
> >
> > How, then, do I back up the master and msdb databases? Is it possible?
> > --
> > John Schuster
> >
> >
> > "Tibor Karaszi" wrote:
> >
> >> Yep, as I suspected. You can't do log backups on databases that are in
> >> simple recovery model.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://sqlblog.com/blogs/tibor_karaszi
> >>
> >>
> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> >> news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
> >> >I do have reporting set up. This is the message I see for the
> >> >maintenance
> >> > plan in question:
> >> >
> >> > Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
> >> > Server
> >> > 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
> >> > Starting maintenance plan 'DB Maintenance Plan master, msdb, model' on
> >> > 9/27/2007 12:00:06 AM
> >> > Backup can not be performed on database 'master'. This sub task is
> >> > ignored.
> >> >
> >> > [1] Database model: Transaction Log Backup...
> >> > Destination: [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
> >> >
> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >> >
> >> > [2] Database model: Verifying Backup...
> >> >
> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >> >
> >> > Backup can not be performed on database 'msdb'. This sub task is
> >> > ignored.
> >> >
> >> > Deleting old text reports... 1 file(s) deleted.
> >> >
> >> > End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
> >> > 9/27/2007 12:00:06 AM
> >> > SQLMAINT.EXE Process Exit Code: 1 (Failed)
> >> > --
> >> > John Schuster
> >> >
> >> >
> >> > "Tibor Karaszi" wrote:
> >> >
> >> >> Specify a report file for the plan and check that file for detailed
> >> >> information about errors,. My
> >> >> guess is that you try to do log backups for databases that are in
> >> >> simple recovery mode. Also, you
> >> >> can't do log backup for master even if you set it to full recovery
> >> >> (master is special).
> >> >>
> >> >> --
> >> >> Tibor Karaszi, SQL Server MVP
> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> http://sqlblog.com/blogs/tibor_karaszi
> >> >>
> >> >>
> >> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
> >> >> >I keepp getting the following error in my application log for SQL
> >> >> >Server 2000:
> >> >> >
> >> >> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB
> >> >> > Maintenance Plan
> >> >> > 'DB Maintenance Plan master, msdb, model''
> >> >> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked on:
> >> >> > 2007-09-27 00:00:05 - Message: The job failed. The Job was invoked
> >> >> > by
> >> >> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step 1).
> >> >> >
> >> >> > Does anyone know what this means?
> >> >> > --
> >> >> >
> >> >> > John Schuster
> >> >>
> >>
>
>|||Recommended backup strategy for system databases (such as master, msdb,
model) is taking full backups of them when you make a change in your SQL
Server system like changing SQL Server configuration, adding new logins,
adding new jobs, adding linked servers etc.
Transaction Log backup is unnecessary for system databases.
--
Ekrem Ã?nsoy
"John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
news:B4858CF1-97B9-4A03-A365-802CFB2C92E9@.microsoft.com...
> Thank you.
> --
> John Schuster
>
> "Chris Wood" wrote:
>> John,
>> You can only perform the Full backup, don't check for the Transaction log
>> backups.
>> Chris
>> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
>> news:0B25B6FF-9A71-4F34-9B23-D77090551424@.microsoft.com...
>> > Tibor,
>> >
>> > How, then, do I back up the master and msdb databases? Is it possible?
>> > --
>> > John Schuster
>> >
>> >
>> > "Tibor Karaszi" wrote:
>> >
>> >> Yep, as I suspected. You can't do log backups on databases that are in
>> >> simple recovery model.
>> >>
>> >> --
>> >> Tibor Karaszi, SQL Server MVP
>> >> http://www.karaszi.com/sqlserver/default.asp
>> >> http://sqlblog.com/blogs/tibor_karaszi
>> >>
>> >>
>> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
>> >> message
>> >> news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
>> >> >I do have reporting set up. This is the message I see for the
>> >> >maintenance
>> >> > plan in question:
>> >> >
>> >> > Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
>> >> > Server
>> >> > 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
>> >> > Starting maintenance plan 'DB Maintenance Plan master, msdb, model'
>> >> > on
>> >> > 9/27/2007 12:00:06 AM
>> >> > Backup can not be performed on database 'master'. This sub task is
>> >> > ignored.
>> >> >
>> >> > [1] Database model: Transaction Log Backup...
>> >> > Destination:
>> >> > [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
>> >> >
>> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
>> >> >
>> >> > [2] Database model: Verifying Backup...
>> >> >
>> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
>> >> >
>> >> > Backup can not be performed on database 'msdb'. This sub task is
>> >> > ignored.
>> >> >
>> >> > Deleting old text reports... 1 file(s) deleted.
>> >> >
>> >> > End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
>> >> > 9/27/2007 12:00:06 AM
>> >> > SQLMAINT.EXE Process Exit Code: 1 (Failed)
>> >> > --
>> >> > John Schuster
>> >> >
>> >> >
>> >> > "Tibor Karaszi" wrote:
>> >> >
>> >> >> Specify a report file for the plan and check that file for detailed
>> >> >> information about errors,. My
>> >> >> guess is that you try to do log backups for databases that are in
>> >> >> simple recovery mode. Also, you
>> >> >> can't do log backup for master even if you set it to full recovery
>> >> >> (master is special).
>> >> >>
>> >> >> --
>> >> >> Tibor Karaszi, SQL Server MVP
>> >> >> http://www.karaszi.com/sqlserver/default.asp
>> >> >> http://sqlblog.com/blogs/tibor_karaszi
>> >> >>
>> >> >>
>> >> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
>> >> >> >I keepp getting the following error in my application log for SQL
>> >> >> >Server 2000:
>> >> >> >
>> >> >> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB
>> >> >> > Maintenance Plan
>> >> >> > 'DB Maintenance Plan master, msdb, model''
>> >> >> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked
>> >> >> > on:
>> >> >> > 2007-09-27 00:00:05 - Message: The job failed. The Job was
>> >> >> > invoked
>> >> >> > by
>> >> >> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step
>> >> >> > 1).
>> >> >> >
>> >> >> > Does anyone know what this means?
>> >> >> > --
>> >> >> >
>> >> >> > John Schuster
>> >> >>
>> >>
>>|||Thank you.
--
John Schuster
"Ekrem Ã?nsoy" wrote:
> Recommended backup strategy for system databases (such as master, msdb,
> model) is taking full backups of them when you make a change in your SQL
> Server system like changing SQL Server configuration, adding new logins,
> adding new jobs, adding linked servers etc.
> Transaction Log backup is unnecessary for system databases.
> --
> Ekrem Ã?nsoy
>
> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> news:B4858CF1-97B9-4A03-A365-802CFB2C92E9@.microsoft.com...
> > Thank you.
> > --
> > John Schuster
> >
> >
> > "Chris Wood" wrote:
> >
> >> John,
> >>
> >> You can only perform the Full backup, don't check for the Transaction log
> >> backups.
> >>
> >> Chris
> >>
> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in message
> >> news:0B25B6FF-9A71-4F34-9B23-D77090551424@.microsoft.com...
> >> > Tibor,
> >> >
> >> > How, then, do I back up the master and msdb databases? Is it possible?
> >> > --
> >> > John Schuster
> >> >
> >> >
> >> > "Tibor Karaszi" wrote:
> >> >
> >> >> Yep, as I suspected. You can't do log backups on databases that are in
> >> >> simple recovery model.
> >> >>
> >> >> --
> >> >> Tibor Karaszi, SQL Server MVP
> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> http://sqlblog.com/blogs/tibor_karaszi
> >> >>
> >> >>
> >> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:78BACDAB-3C67-41B5-AB69-B67A701B45BE@.microsoft.com...
> >> >> >I do have reporting set up. This is the message I see for the
> >> >> >maintenance
> >> >> > plan in question:
> >> >> >
> >> >> > Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
> >> >> > Server
> >> >> > 'EPDDOCS3' as 'SEP\EPDDOCS3$' (trusted)
> >> >> > Starting maintenance plan 'DB Maintenance Plan master, msdb, model'
> >> >> > on
> >> >> > 9/27/2007 12:00:06 AM
> >> >> > Backup can not be performed on database 'master'. This sub task is
> >> >> > ignored.
> >> >> >
> >> >> > [1] Database model: Transaction Log Backup...
> >> >> > Destination:
> >> >> > [X:\MSSQL\EPDdocs_BACKUP\model_tlog_200709270000.TRN]
> >> >> >
> >> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >> >> >
> >> >> > [2] Database model: Verifying Backup...
> >> >> >
> >> >> > ** Execution Time: 0 hrs, 0 mins, 1 secs **
> >> >> >
> >> >> > Backup can not be performed on database 'msdb'. This sub task is
> >> >> > ignored.
> >> >> >
> >> >> > Deleting old text reports... 1 file(s) deleted.
> >> >> >
> >> >> > End of maintenance plan 'DB Maintenance Plan master, msdb, model' on
> >> >> > 9/27/2007 12:00:06 AM
> >> >> > SQLMAINT.EXE Process Exit Code: 1 (Failed)
> >> >> > --
> >> >> > John Schuster
> >> >> >
> >> >> >
> >> >> > "Tibor Karaszi" wrote:
> >> >> >
> >> >> >> Specify a report file for the plan and check that file for detailed
> >> >> >> information about errors,. My
> >> >> >> guess is that you try to do log backups for databases that are in
> >> >> >> simple recovery mode. Also, you
> >> >> >> can't do log backup for master even if you set it to full recovery
> >> >> >> (master is special).
> >> >> >>
> >> >> >> --
> >> >> >> Tibor Karaszi, SQL Server MVP
> >> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> >> http://sqlblog.com/blogs/tibor_karaszi
> >> >> >>
> >> >> >>
> >> >> >> "John Schuster" <JohnSchuster@.discussions.microsoft.com> wrote in
> >> >> >> message
> >> >> >> news:C87E4F0D-D670-4496-9169-2BF3E0922749@.microsoft.com...
> >> >> >> >I keepp getting the following error in my application log for SQL
> >> >> >> >Server 2000:
> >> >> >> >
> >> >> >> > SQL Server Scheduled Job 'Transaction Log Backup Job for DB
> >> >> >> > Maintenance Plan
> >> >> >> > 'DB Maintenance Plan master, msdb, model''
> >> >> >> > (0x0D97085E32705247B590ADA245D3FE07) - Status: Failed - Invoked
> >> >> >> > on:
> >> >> >> > 2007-09-27 00:00:05 - Message: The job failed. The Job was
> >> >> >> > invoked
> >> >> >> > by
> >> >> >> > Schedule 76 (Schedule 1). The last step to run was step 1 (Step
> >> >> >> > 1).
> >> >> >> >
> >> >> >> > Does anyone know what this means?
> >> >> >> > --
> >> >> >> >
> >> >> >> > John Schuster
> >> >> >>
> >> >>
> >>
> >>
> >>
>

Friday, February 24, 2012

Auto-Grow and Shrink Via Code

Hey guys,
Does anybody know of a way to turn on the Auto-Grow feature for a
transaction log via T-SQL code? What we want to do is during a
scheduled job, turn the auto grow feature on then after the job is
finished, shrink the log, then cut auto grow back off?
Any thoughts? Thanks in advance!
Hunter
**************Please Post to Group so that all can benefit!Have you looked at the ALTER DATABASE topic in Books Online? Of particular
interest:
AUTO_SHRINK ON | OFF
If ON is specified, the database files are candidates for automatic periodic
shrinking.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Hunter" <bamared36054@.yahoo.com> wrote in message
news:2a0a8bc1.0312020836.3923452e@.posting.google.com...
> Hey guys,
> Does anybody know of a way to turn on the Auto-Grow feature for a
> transaction log via T-SQL code? What we want to do is during a
> scheduled job, turn the auto grow feature on then after the job is
> finished, shrink the log, then cut auto grow back off?
> Any thoughts? Thanks in advance!
> Hunter
> **************Please Post to Group so that all can benefit!|||Sorry, wrong section... 'grow' != 'shrink' Aaron! Look under filespec:
< filespec > ::=( NAME = logical_file_name
[ , NEWNAME = new_logical_name ]
[ , FILENAME = 'os_file_name' ]
[ , SIZE = size ]
[ , MAXSIZE = { max_size | UNLIMITED } ]
[ , FILEGROWTH = growth_increment ] )
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/