Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

Maintenance plan error in SQL Server 2000(SP3) Standard Ed!

Hi,
I have delete the user BUILTIN\Administrators, afte that
Maintenance Plan jobs are failed with the following error:
Microsoft (R) SQLMaint Utility (Unicode), Version
[Microsoft SQL-DMO (ODBC SQLState: 28000)] Error 18456:
[Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user 'NT AUTHORITY\SYSTEM'.
I have given access to the User, under which SQL Server
Agent services runs.
When i added back the user BUILTIN\Administrators, after
that it's runing fine. Please suggest for above problem.
I appreciate it.
Thanks
ssWhat account was the job set up under? And with which account is the
sqlagent running?
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

Monday, March 26, 2012

maintenance plan and sub-directory

Hello there,
We have a maintenance plan to backup five user databases, we select "create
a sub-directory" and backup file to "d:\sql\backup", one of database backup
files did go to subdirectory of "d:\sql\backup", system put backup files in
"d:\sql\backup",
Anybody has idea? I appreciate your reply
Thanks very much
LionelHi
It's not clear if these are different database in the same job or different
locations for the same database!!
I would expect the location to be consistent for each database within a
given job, therefore all full backups are either in one directory or each
sub-directory and the transaction log backups are either in one directory or
one sub-directory for each database.
You may also want to check the dates and times one the files.
John
"lionel" wrote:

> Hello there,
> We have a maintenance plan to backup five user databases, we select "creat
e
> a sub-directory" and backup file to "d:\sql\backup", one of database backu
p
> files did go to subdirectory of "d:\sql\backup", system put backup files i
n
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>|||Does the folder exist for that specific db? I have seen issues where when
the MP can not get access to the specified folder it uses the next level up
instead. Another reason why I hate MP's.
Andrew J. Kelly SQL MVP
"lionel" <lionel@.discussions.microsoft.com> wrote in message
news:CFB6734A-EEC3-4707-A47E-F4F399E12746@.microsoft.com...
> Hello there,
> We have a maintenance plan to backup five user databases, we select
> "create
> a sub-directory" and backup file to "d:\sql\backup", one of database
> backup
> files did go to subdirectory of "d:\sql\backup", system put backup files
> in
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>

maintenance plan and sub-directory

Hello there,
We have a maintenance plan to backup five user databases, we select "create
a sub-directory" and backup file to "d:\sql\backup", one of database backup
files did go to subdirectory of "d:\sql\backup", system put backup files in
"d:\sql\backup",
Anybody has idea? I appreciate your reply
Thanks very much
Lionel
Hi
It's not clear if these are different database in the same job or different
locations for the same database!!
I would expect the location to be consistent for each database within a
given job, therefore all full backups are either in one directory or each
sub-directory and the transaction log backups are either in one directory or
one sub-directory for each database.
You may also want to check the dates and times one the files.
John
"lionel" wrote:

> Hello there,
> We have a maintenance plan to backup five user databases, we select "create
> a sub-directory" and backup file to "d:\sql\backup", one of database backup
> files did go to subdirectory of "d:\sql\backup", system put backup files in
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>
|||Does the folder exist for that specific db? I have seen issues where when
the MP can not get access to the specified folder it uses the next level up
instead. Another reason why I hate MP's.
Andrew J. Kelly SQL MVP
"lionel" <lionel@.discussions.microsoft.com> wrote in message
news:CFB6734A-EEC3-4707-A47E-F4F399E12746@.microsoft.com...
> Hello there,
> We have a maintenance plan to backup five user databases, we select
> "create
> a sub-directory" and backup file to "d:\sql\backup", one of database
> backup
> files did go to subdirectory of "d:\sql\backup", system put backup files
> in
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>

maintenance plan and sub-directory

Hello there,
We have a maintenance plan to backup five user databases, we select "create
a sub-directory" and backup file to "d:\sql\backup", one of database backup
files did go to subdirectory of "d:\sql\backup", system put backup files in
"d:\sql\backup",
Anybody has idea? I appreciate your reply
Thanks very much
LionelHi
It's not clear if these are different database in the same job or different
locations for the same database!!
I would expect the location to be consistent for each database within a
given job, therefore all full backups are either in one directory or each
sub-directory and the transaction log backups are either in one directory or
one sub-directory for each database.
You may also want to check the dates and times one the files.
John
"lionel" wrote:
> Hello there,
> We have a maintenance plan to backup five user databases, we select "create
> a sub-directory" and backup file to "d:\sql\backup", one of database backup
> files did go to subdirectory of "d:\sql\backup", system put backup files in
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>|||Does the folder exist for that specific db? I have seen issues where when
the MP can not get access to the specified folder it uses the next level up
instead. Another reason why I hate MP's.
--
Andrew J. Kelly SQL MVP
"lionel" <lionel@.discussions.microsoft.com> wrote in message
news:CFB6734A-EEC3-4707-A47E-F4F399E12746@.microsoft.com...
> Hello there,
> We have a maintenance plan to backup five user databases, we select
> "create
> a sub-directory" and backup file to "d:\sql\backup", one of database
> backup
> files did go to subdirectory of "d:\sql\backup", system put backup files
> in
> "d:\sql\backup",
> Anybody has idea? I appreciate your reply
> Thanks very much
> Lionel
>sql

Friday, March 23, 2012

Maintenance Job not working properly

Hi,

I an new to the forum.

I am having some problems where my maintenance job is not backing up the user databases in SQL2000. Unfortunately, I found out the hard way as my payroll in GP did not run properly and I had to do a restore from the BAK file.

I am receiving the following error msg in the event log

Status: Failed - Invoked on: 2006-04-11 22:00:02 - Message: The job failed. The owner () of job DB Backup Job for DB Maintenance Plan 'Daily Backup of User Databases' does not have server access.

I cannot find where and how the user permission was chmaged on this job. I would like some assistance with this problem.

thanks

Raymond

Hi,

Go to Jobs list under SQL Server Agent in the Enterprise Manager.

Find the job for the maintenance plan you have created. Name of the job will include the name of the maintenance plan.

If you open the job properties screen and activate the Steps tab. You will see the "run as user" in the advanced tab of the edit job steps screen.

Check this user for necessary credentials.

Also control the owner of the job in the main job properties screen.

Eralper

Wednesday, March 21, 2012

Maintenance - Integrity Check failure

Found log for job:
'Error: 4062, Cannot open user default database '<ID>'.
Using master db instead.'
Will check Microsoft Error list.

>--Original Message--
>I've got a database in SQL Server 7/Windows 2000 that is
>maintained through 'Database Maintenance Plans'.
>Integrity of the database is checked once a week
>using 'Integrity Check'. The weekly 'Integrity Check'
is
>failing. The error message given is 'The job has failed
>in step one, please review step 1' and nothing is put
>into the application event log. The transaction sql
>command for checking the integrity check of a database
is
>DBCC Checkdb('database'). The command line integrity
>check works fine and returns no errors.
>Failures are also occuring for 'Update Statistics used
by
>query optimizer' and 'Reorganize data and index pages'
in
>Maintenance.
>What is causing these maintenance plans to fail?
>.
>If you get this when SQL Agent logs in to run a job then
most likely the default database for the SQL Agent service
account is assigned to a database that no longer exists on
the server. You may want to check the default database for
that account. You'd probably want it set to master.
-Sue
On Wed, 7 Apr 2004 14:24:33 -0700, "Jim"
<anonymous@.discussions.microsoft.com> wrote:
>Found log for job:
>'Error: 4062, Cannot open user default database '<ID>'.
>Using master db instead.'
>Will check Microsoft Error list.
>
>is
>is
>by
>in|||You should also not automatically repair errors. You shoudl always do
root-cause analysis as these errors are usually an indication that you have
a hardware problem.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:73ma70t1m49tgqnqmk0ccuiopd3qd4n4rj@.
4ax.com...
> If you get this when SQL Agent logs in to run a job then
> most likely the default database for the SQL Agent service
> account is assigned to a database that no longer exists on
> the server. You may want to check the default database for
> that account. You'd probably want it set to master.
> -Sue
> On Wed, 7 Apr 2004 14:24:33 -0700, "Jim"
> <anonymous@.discussions.microsoft.com> wrote:
>
>

Maintenance - Integrity Check failure

Found log for job:
'Error: 4062, Cannot open user default database '<ID>'.
Using master db instead.'
Will check Microsoft Error list.

>--Original Message--
>I've got a database in SQL Server 7/Windows 2000 that is
>maintained through 'Database Maintenance Plans'.
>Integrity of the database is checked once a week
>using 'Integrity Check'. The weekly 'Integrity Check'
is
>failing. The error message given is 'The job has failed
>in step one, please review step 1' and nothing is put
>into the application event log. The transaction sql
>command for checking the integrity check of a database
is
>DBCC Checkdb('database'). The command line integrity
>check works fine and returns no errors.
>Failures are also occuring for 'Update Statistics used
by
>query optimizer' and 'Reorganize data and index pages'
in
>Maintenance.
>What is causing these maintenance plans to fail?
>.
>
If you get this when SQL Agent logs in to run a job then
most likely the default database for the SQL Agent service
account is assigned to a database that no longer exists on
the server. You may want to check the default database for
that account. You'd probably want it set to master.
-Sue
On Wed, 7 Apr 2004 14:24:33 -0700, "Jim"
<anonymous@.discussions.microsoft.com> wrote:
>Found log for job:
>'Error: 4062, Cannot open user default database '<ID>'.
>Using master db instead.'
>Will check Microsoft Error list.
>
>is
>is
>by
>in
|||You should also not automatically repair errors. You shoudl always do
root-cause analysis as these errors are usually an indication that you have
a hardware problem.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:73ma70t1m49tgqnqmk0ccuiopd3qd4n4rj@.4ax.com...
> If you get this when SQL Agent logs in to run a job then
> most likely the default database for the SQL Agent service
> account is assigned to a database that no longer exists on
> the server. You may want to check the default database for
> that account. You'd probably want it set to master.
> -Sue
> On Wed, 7 Apr 2004 14:24:33 -0700, "Jim"
> <anonymous@.discussions.microsoft.com> wrote:
>

Monday, March 19, 2012

Maintaining user formatting in multiline textbox

In a multiline textbox, how do you maintain paragraph breaks that users may create (like what you see on this forum)?

Are the returns replaced by something else just before being saved to the database? Any assistance would be appreciated!

MichaelWhat I have done with classic ASP is replace all vbCRLF with <BR>. I believe it is the same thing with ASP.NET.

Terri

Maintaining a log for the users connected to sql server db.

Hi !

I need to maintain a record such as how many time any user (e.g, sa) connects to the sql server. Means whenever any person is connecting to the database through application or directly, then i need to know that through which sql user(e.g sa), any body connected.

Regards,
Shabber Abbas Rizvi.create server side trace file for security Audit events.For more information visit

http://search.atomz.com/search/?sp-q=trace&sp-a=sp10010351

maintainance

I have a SQL server database application,
I just wnated to know that may I maintain the system while user use the
sysetm?
Should I maintain the system while all user off line?
Any information is great appreciated,Hi
It depends on what you are doing, but usually if you can schedule
maintenance when the system is quiet/down it will have less impact. Using
SQL Agent you can schedule your maintainance tasks for quiet times
John
"Souris" <Souris@.discussions.microsoft.com> wrote in message
news:9D26D4FF-1404-4E34-B19D-6DF86A34865D@.microsoft.com...
>I have a SQL server database application,
> I just wnated to know that may I maintain the system while user use the
> sysetm?
> Should I maintain the system while all user off line?
> Any information is great appreciated,
>|||As John said, it depends on the action you want to perform. If you have a
24/7 database you sure have no time slot to do a cold backup ;-). But as
John said, i wouldt places IO-based Activity (rebuilding of indexes) in the
primary processing time. If you have any questions for the details of your
actions you want to perform, do not hesitate to ask.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Souris" <Souris@.discussions.microsoft.com> schrieb im Newsbeitrag
news:9D26D4FF-1404-4E34-B19D-6DF86A34865D@.microsoft.com...
>I have a SQL server database application,
> I just wnated to know that may I maintain the system while user use the
> sysetm?
> Should I maintain the system while all user off line?
> Any information is great appreciated,
>

Maintain Report State

I have a matrix report where the user can drill down into a hierarchy to view
data for a particular product. The report also includes a parameter list
allowing the user to change the selected product.
The problem with this approach is that the user may drill to a specific
branch and then decide to switch products. At that point the report refreshes
and collapses back to the root node, because I have defined the report to
hide all groups on first entry.
Given that I am using Report Manager with no custom front end, does anyone
know of a good strategy to maintain state so that I can retain which groups
are expanded and collapsed for a particular user between instances of the
report?Modifying the Report Parameter causes the query to be executed. When this
happens the report is rendered from scratch. Hence you will not be able to
maintain the state of how the groups are displayed.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dave Morrow" <DaveMorrow@.discussions.microsoft.com> wrote in message
news:413E2C03-1362-4130-A16B-F7E371D2E0F3@.microsoft.com...
>I have a matrix report where the user can drill down into a hierarchy to
>view
> data for a particular product. The report also includes a parameter list
> allowing the user to change the selected product.
> The problem with this approach is that the user may drill to a specific
> branch and then decide to switch products. At that point the report
> refreshes
> and collapses back to the root node, because I have defined the report to
> hide all groups on first entry.
> Given that I am using Report Manager with no custom front end, does anyone
> know of a good strategy to maintain state so that I can retain which
> groups
> are expanded and collapsed for a particular user between instances of the
> report?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server 200
0 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything else?Hi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> ---
> Posted via http://www.webservertalk.com
> ---
> View this thread: http://www.webservertalk.com/message1430463.html
>|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:

> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server
2000 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything
else?
--
JamesNZ
---
Posted via http://www.webservertalk.com
---
View this thread: http://www.webservertalk.com/message1430463.htmlHi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> ---
> Posted via http://www.webservertalk.com
> ---
> View this thread: http://www.webservertalk.com/message1430463.html
>|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Maintain Jobs, View Logs

I have a user who needs to check whether 2 jobs have run on a SQL Server
2000 instance, and be able to view logs.
Is there a way of doing this, and not allowing them access to anything
else?
JamesNZ
Posted via http://www.webservertalk.com
View this thread: http://www.webservertalk.com/message1430463.html
Hi
Does the use have EM on his/her workstation?
Does the user have permissions to run the job?
See this example written by Neil
/*** Scheduled task reporter for SQL 2000
**** Copyright Neil Boyle 2003.
**** Use entirely at your own risk
***/
use MSDB
go
select convert(varchar(22), j.name) as job_name
, case freq_type -- Daily, weekly, Monthly
when 1 then 'Once'
when 4 then 'Daily'
when 8 then 'Wk ' -- For weekly, add in the days of the week
+ case freq_interval & 2 when 2 then 'M' else '' end -- Monday
+ case freq_interval & 4 when 4 then 'Tu' else '' end -- Tuesday
+ case freq_interval & 8 when 8 then 'W' else '' end -- etc
+ case freq_interval & 16 when 16 then 'Th' else '' end
+ case freq_interval & 32 when 32 then 'F' else '' end
+ case freq_interval & 64 when 64 then 'Sa' else '' end
+ case freq_interval & 1 when 1 then 'Su' else '' end
when 16 then 'Mthly on day ' + convert(varchar(2), freq_interval) --
Monthly on a particular day
when 32 then 'Mthly ' -- The most complicated one, "every third Friday
of the month" for example
+ case freq_relative_interval
when 1 then 'Every First '
when 2 then 'Every Second '
when 4 then 'Every Third '
when 8 then 'Every Fourth '
when 16 then 'Every Last '
end
+ case freq_interval
when 1 then 'Sunday'
when 2 then 'Monday'
when 3 then 'Tuesday'
when 4 then 'Wednesday'
when 5 then 'Thursday'
when 6 then 'Friday'
when 7 then 'Saturday'
when 8 then 'Day'
when 9 then 'Week day'
when 10 then 'Weekend day'
end
when 64 then 'Startup' -- When SQL Server starts
when 128 then 'Idle' -- Whenever SQL Server gets bored
else 'Err' -- This should never happen
end as schedule
, case freq_subday_type -- FOr when a job funs every few seconds, minutes
or hours
when 1 then 'Runs once at:'
when 2 then 'every ' + convert(varchar(3), freq_subday_interval) + '
seconds'
when 4 then 'every ' + convert(varchar(3), freq_subday_interval) + '
minutes'
when 8 then 'every ' + convert(varchar(3), freq_subday_interval) + '
hours'
end as frequency
-- All the subsrings are because the times are stored as an integer with no
leading zeroes
-- i.e. 0 means midnight, 13000 means half past one in the morning
(01:30:00)
, substring (right (stuff (' ', 1, 1, '000000') +
convert(varchar(6),active_start_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_start_time), 6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6),active_start_time),
6) ,5 ,2) as start_at
,case freq_subday_type
when 1 then NULL -- Ignore the end time if not a recurring job
else substring (right (stuff (' ', 1, 1, '000000') + convert(varchar(6),
active_end_time), 6), 1, 2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,3 ,2)
+ ':'
+ substring (
right (stuff (' ', 1, 1, '000000') + convert(varchar(6), active_end_time),
6) ,5 ,2) end as end_at
from sysjobs j
join sysJobSchedules s
on j.job_id = s.job_id
order by j.name, start_at
"JamesNZ" <JamesNZ.24lo0y@.mail.webservertalk.com> wrote in message
news:JamesNZ.24lo0y@.mail.webservertalk.com...
> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?
>
> --
> JamesNZ
> Posted via http://www.webservertalk.com
> View this thread: http://www.webservertalk.com/message1430463.html
>
|||Here is one solution which should work for you:
1. Create a SP using the following script. Just mention your job names in
the following line of the script:
--sj.name in ('Job1', 'Job2') and
CREATE PROCEDURE dbo.read_jobhistory
as
select sjh.server, sj.name, case sjh.run_status
when 0 then 'Failed'
when 1 then 'Succeeded'
when 2 then 'Retry'
when 3 then 'Canceled'
when 4 then 'In progress'
end as 'Job Status',
sjh.sql_message_id, sjh.sql_severity,sjh.message,
convert(datetime, cast (sjh.run_date as char(8)) + ' ' +
left(right('000000' + cast (sjh.run_time as varchar(6)),6),2) + ':' +
substring(right('000000' + cast (sjh.run_time as varchar(6)),6),3,2) + ':' +
right('000000' + cast (sjh.run_time as varchar(6)),2))as 'Run Date',
sjh.run_duration, sjh.operator_id_emailed,
sjh.operator_id_netsent, sjh.operator_id_paged, sjh.retries_attempted
from
msdb..sysjobhistory sjh
join msdb..sysjobs sj
on sjh.job_id = sj.job_id
where
sj.name in ('Job1', 'Job2') and
step_id = 0
and sjh.run_date >= convert(char(10),getdate(),112)
order by sjh.server, sj.name, sjh.run_date, sjh.run_time
2. Grant Execution on this SP to the concerned user.
3. The concerned user can get the report for the today's date just by
executing the SP.
"JamesNZ" wrote:

> I have a user who needs to check whether 2 jobs have run on a SQL Server
> 2000 instance, and be able to view logs.
> Is there a way of doing this, and not allowing them access to anything
> else?

Monday, March 12, 2012

maintain audit trail of access to SQL server 2000 database

Is there any way to maintain audit trail of access to my SQL server 2000 database by any user ? I need to log the timestamp of any insert/update/delete to any record in a table within the database by the user.

Alex

Hi,

You need to enable Audit Schema Object Access Event for an audit, which is responsible for recording access to all schema objects including tables. Further you need to filer by database name, such that only events in a database you are interested in are recorded. Since you want to audit insert/update/delete for tables in database you need to place additional filters:

ObjectType = 'U' -- means user table

Permissions = 0x1a -- 0x2 | 0x8 | 0x10

You can further filer by table name (ObjectName column) if you wish.

The setup of the event described above can be easily done using SQL Server Profiler. Use "Column Filters" button to setup filters.

Let me know if you have further questions,

Ruslan

|||

ruslan ovechkin1 wrote:

Hi,

You need to enable Audit Schema Object Access Event for an audit, which is responsible for recording access to all schema objects including tables. Further you need to filer by database name, such that only events in a database you are interested in are recorded. Since you want to audit insert/update/delete for tables in database you need to place additional filters:

ObjectType = 'U' -- means user table

Permissions = 0x1a -- 0x2 | 0x8 | 0x10

You can further filer by table name (ObjectName column) if you wish.

The setup of the event described above can be easily done using SQL Server Profiler. Use "Column Filters" button to setup filters.

Let me know if you have further questions,

Ruslan

After enabling this, is it possibel to take report for the same ?

Vishal

maintain audit trail of access to SQL server 2000 database

Is there any way to maintain audit trail of access to my SQL server 2000 database by any user ? I need to log the timestamp of any insert/update/delete to any record in a table within the database by the user.

Alex

Hi,

You need to enable Audit Schema Object Access Event for an audit, which is responsible for recording access to all schema objects including tables. Further you need to filer by database name, such that only events in a database you are interested in are recorded. Since you want to audit insert/update/delete for tables in database you need to place additional filters:

ObjectType = 'U' -- means user table

Permissions = 0x1a -- 0x2 | 0x8 | 0x10

You can further filer by table name (ObjectName column) if you wish.

The setup of the event described above can be easily done using SQL Server Profiler. Use "Column Filters" button to setup filters.

Let me know if you have further questions,

Ruslan

|||

ruslan ovechkin1 wrote:

Hi,

You need to enable Audit Schema Object Access Event for an audit, which is responsible for recording access to all schema objects including tables. Further you need to filer by database name, such that only events in a database you are interested in are recorded. Since you want to audit insert/update/delete for tables in database you need to place additional filters:

ObjectType = 'U' -- means user table

Permissions = 0x1a -- 0x2 | 0x8 | 0x10

You can further filer by table name (ObjectName column) if you wish.

The setup of the event described above can be easily done using SQL Server Profiler. Use "Column Filters" button to setup filters.

Let me know if you have further questions,

Ruslan

After enabling this, is it possibel to take report for the same ?

Vishal

Maint. Plan Backups and Single User Mode

I am trying to come up with the best solution for the following issue:
I have a specific DB that needs to be backed up in single user mode. I
want to do this with a a Maitenance Plan but I am not sure if that is
possible or makes sense.
What are my options? Do I have to backup with a script? I would like
the Maint. Plan to kick off the ALTER DB script to kick out users.
Thanks for the help.Why is single-user mode a requirement?
That said, you can eschew the maintenance plan and just script out the
ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
<wfj5444@.gmail.com> wrote in message
news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
I am trying to come up with the best solution for the following issue:
I have a specific DB that needs to be backed up in single user mode. I
want to do this with a a Maitenance Plan but I am not sure if that is
possible or makes sense.
What are my options? Do I have to backup with a script? I would like
the Maint. Plan to kick off the ALTER DB script to kick out users.
Thanks for the help.|||Tom,
is there any refrences on your method, in online books or on the web.
Thanks
"Tom Moreau" wrote:
> Why is single-user mode a requirement?
> That said, you can eschew the maintenance plan and just script out the
> ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> ..
> <wfj5444@.gmail.com> wrote in message
> news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> I am trying to come up with the best solution for the following issue:
> I have a specific DB that needs to be backed up in single user mode. I
> want to do this with a a Maitenance Plan but I am not sure if that is
> possible or makes sense.
> What are my options? Do I have to backup with a script? I would like
> the Maint. Plan to kick off the ALTER DB script to kick out users.
> Thanks for the help.
>|||Basically, check out the following in the BOL:
ALTER DATABASE
BACKUP DATABASE
sp_add_job
sp_add_jobstep
Also, I am curious as to why single-user mode is a requirement.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
Tom,
is there any refrences on your method, in online books or on the web.
Thanks
"Tom Moreau" wrote:
> Why is single-user mode a requirement?
> That said, you can eschew the maintenance plan and just script out the
> ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> ..
> <wfj5444@.gmail.com> wrote in message
> news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> I am trying to come up with the best solution for the following issue:
> I have a specific DB that needs to be backed up in single user mode. I
> want to do this with a a Maitenance Plan but I am not sure if that is
> possible or makes sense.
> What are my options? Do I have to backup with a script? I would like
> the Maint. Plan to kick off the ALTER DB script to kick out users.
> Thanks for the help.
>|||Thanks Tom.
The reason is due to a specific table that gets corrupted if users are
accessing it during backup.
I can not think of more simple solution than going single user, backing
it up and then returning to multi user.
Tom Moreau wrote:
> Basically, check out the following in the BOL:
> ALTER DATABASE
> BACKUP DATABASE
> sp_add_job
> sp_add_jobstep
> Also, I am curious as to why single-user mode is a requirement.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> Tom,
> is there any refrences on your method, in online books or on the web.
> Thanks
> "Tom Moreau" wrote:
> > Why is single-user mode a requirement?
> >
> > That said, you can eschew the maintenance plan and just script out the
> > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > ..
> > <wfj5444@.gmail.com> wrote in message
> > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > I am trying to come up with the best solution for the following issue:
> >
> > I have a specific DB that needs to be backed up in single user mode. I
> > want to do this with a a Maitenance Plan but I am not sure if that is
> > possible or makes sense.
> >
> > What are my options? Do I have to backup with a script? I would like
> > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >
> > Thanks for the help.
> >
> >|||If the table is getting corrupted, then it's possible that the app is not
properly designed. We'd have to know more first. You could start a
transaction and:
1) begin a transaction
2) do a SELECT on the table with TABLOCKX
3) do the backup
4) rollback the transaction
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
<wfj5444@.gmail.com> wrote in message
news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
Thanks Tom.
The reason is due to a specific table that gets corrupted if users are
accessing it during backup.
I can not think of more simple solution than going single user, backing
it up and then returning to multi user.
Tom Moreau wrote:
> Basically, check out the following in the BOL:
> ALTER DATABASE
> BACKUP DATABASE
> sp_add_job
> sp_add_jobstep
> Also, I am curious as to why single-user mode is a requirement.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> Tom,
> is there any refrences on your method, in online books or on the web.
> Thanks
> "Tom Moreau" wrote:
> > Why is single-user mode a requirement?
> >
> > That said, you can eschew the maintenance plan and just script out the
> > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > ..
> > <wfj5444@.gmail.com> wrote in message
> > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > I am trying to come up with the best solution for the following issue:
> >
> > I have a specific DB that needs to be backed up in single user mode. I
> > want to do this with a a Maitenance Plan but I am not sure if that is
> > possible or makes sense.
> >
> > What are my options? Do I have to backup with a script? I would like
> > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >
> > Thanks for the help.
> >
> >|||Ah, before I do that let me confirm that you are correct this is an
application issue.
Since this is a boxed application, I do not want to change how it
handles this table.
Do you see any other ways to work around the problem?
Tom Moreau wrote:
> If the table is getting corrupted, then it's possible that the app is not
> properly designed. We'd have to know more first. You could start a
> transaction and:
> 1) begin a transaction
> 2) do a SELECT on the table with TABLOCKX
> 3) do the backup
> 4) rollback the transaction
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> <wfj5444@.gmail.com> wrote in message
> news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> Thanks Tom.
> The reason is due to a specific table that gets corrupted if users are
> accessing it during backup.
> I can not think of more simple solution than going single user, backing
> it up and then returning to multi user.
>
>
> Tom Moreau wrote:
> > Basically, check out the following in the BOL:
> >
> > ALTER DATABASE
> > BACKUP DATABASE
> > sp_add_job
> > sp_add_jobstep
> >
> > Also, I am curious as to why single-user mode is a requirement.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> > Tom,
> > is there any refrences on your method, in online books or on the web.
> > Thanks
> >
> > "Tom Moreau" wrote:
> >
> > > Why is single-user mode a requirement?
> > >
> > > That said, you can eschew the maintenance plan and just script out the
> > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> > >
> > > --
> > > Tom
> > >
> > > ----
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > SQL Server MVP
> > > Toronto, ON Canada
> > > ..
> > > <wfj5444@.gmail.com> wrote in message
> > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > > I am trying to come up with the best solution for the following issue:
> > >
> > > I have a specific DB that needs to be backed up in single user mode. I
> > > want to do this with a a Maitenance Plan but I am not sure if that is
> > > possible or makes sense.
> > >
> > > What are my options? Do I have to backup with a script? I would like
> > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> > >
> > > Thanks for the help.
> > >
> > >|||Is it that just this one table will be "corrupt" or will other tables get
corrupted as well? If it's the former, my previous method will handle it.
If it's the later, I'd be tempted to shut down the middle tier, but putting
the DB into single user mode (and killing any running connections to that
DB) would do so as well. Check out the BOL for ALTER DATABASE.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Will" <wfj5444@.gmail.com> wrote in message
news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
Ah, before I do that let me confirm that you are correct this is an
application issue.
Since this is a boxed application, I do not want to change how it
handles this table.
Do you see any other ways to work around the problem?
Tom Moreau wrote:
> If the table is getting corrupted, then it's possible that the app is not
> properly designed. We'd have to know more first. You could start a
> transaction and:
> 1) begin a transaction
> 2) do a SELECT on the table with TABLOCKX
> 3) do the backup
> 4) rollback the transaction
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> <wfj5444@.gmail.com> wrote in message
> news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> Thanks Tom.
> The reason is due to a specific table that gets corrupted if users are
> accessing it during backup.
> I can not think of more simple solution than going single user, backing
> it up and then returning to multi user.
>
>
> Tom Moreau wrote:
> > Basically, check out the following in the BOL:
> >
> > ALTER DATABASE
> > BACKUP DATABASE
> > sp_add_job
> > sp_add_jobstep
> >
> > Also, I am curious as to why single-user mode is a requirement.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> > Tom,
> > is there any refrences on your method, in online books or on the web.
> > Thanks
> >
> > "Tom Moreau" wrote:
> >
> > > Why is single-user mode a requirement?
> > >
> > > That said, you can eschew the maintenance plan and just script out the
> > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> > >
> > > --
> > > Tom
> > >
> > > ----
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > SQL Server MVP
> > > Toronto, ON Canada
> > > ..
> > > <wfj5444@.gmail.com> wrote in message
> > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > > I am trying to come up with the best solution for the following issue:
> > >
> > > I have a specific DB that needs to be backed up in single user mode.
> > > I
> > > want to do this with a a Maitenance Plan but I am not sure if that is
> > > possible or makes sense.
> > >
> > > What are my options? Do I have to backup with a script? I would like
> > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> > >
> > > Thanks for the help.
> > >
> > >|||Yes it is the first, the table will be corrupted causing an issue for
one type of data.
When this happens, we have to clean the table and let the app recreate
an empty version.
Sorry you refer to your former method, which method? The ALTER DB
example from above?
Tom Moreau wrote:
> Is it that just this one table will be "corrupt" or will other tables get
> corrupted as well? If it's the former, my previous method will handle it.
> If it's the later, I'd be tempted to shut down the middle tier, but putting
> the DB into single user mode (and killing any running connections to that
> DB) would do so as well. Check out the BOL for ALTER DATABASE.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> Ah, before I do that let me confirm that you are correct this is an
> application issue.
> Since this is a boxed application, I do not want to change how it
> handles this table.
> Do you see any other ways to work around the problem?
>
> Tom Moreau wrote:
> > If the table is getting corrupted, then it's possible that the app is not
> > properly designed. We'd have to know more first. You could start a
> > transaction and:
> >
> > 1) begin a transaction
> > 2) do a SELECT on the table with TABLOCKX
> > 3) do the backup
> > 4) rollback the transaction
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > <wfj5444@.gmail.com> wrote in message
> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> > Thanks Tom.
> >
> > The reason is due to a specific table that gets corrupted if users are
> > accessing it during backup.
> >
> > I can not think of more simple solution than going single user, backing
> > it up and then returning to multi user.
> >
> >
> >
> >
> > Tom Moreau wrote:
> > > Basically, check out the following in the BOL:
> > >
> > > ALTER DATABASE
> > > BACKUP DATABASE
> > > sp_add_job
> > > sp_add_jobstep
> > >
> > > Also, I am curious as to why single-user mode is a requirement.
> > >
> > > --
> > > Tom
> > >
> > > ----
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > SQL Server MVP
> > > Toronto, ON Canada
> > > .
> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> > > Tom,
> > > is there any refrences on your method, in online books or on the web.
> > > Thanks
> > >
> > > "Tom Moreau" wrote:
> > >
> > > > Why is single-user mode a requirement?
> > > >
> > > > That said, you can eschew the maintenance plan and just script out the
> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> > > >
> > > > --
> > > > Tom
> > > >
> > > > ----
> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > > SQL Server MVP
> > > > Toronto, ON Canada
> > > > ..
> > > > <wfj5444@.gmail.com> wrote in message
> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > > > I am trying to come up with the best solution for the following issue:
> > > >
> > > > I have a specific DB that needs to be backed up in single user mode.
> > > > I
> > > > want to do this with a a Maitenance Plan but I am not sure if that is
> > > > possible or makes sense.
> > > >
> > > > What are my options? Do I have to backup with a script? I would like
> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> > > >
> > > > Thanks for the help.
> > > >
> > > >|||I noticed you mention corruption in a particular table - after taking the
backup
- is the backup part of a maintenance plan?
If so does the maintenance plan perform integrity check/repair and or
optimization before backup.
- How do you determine corruption of your table afterwards.
- What errors do you get when you run dbcc checkdb or checktable?
When you run select @.@.version what SQL build number are you on?
"wfj5444@.gmail.com" wrote:
> I am trying to come up with the best solution for the following issue:
> I have a specific DB that needs to be backed up in single user mode. I
> want to do this with a a Maitenance Plan but I am not sure if that is
> possible or makes sense.
> What are my options? Do I have to backup with a script? I would like
> the Maint. Plan to kick off the ALTER DB script to kick out users.
> Thanks for the help.
>|||Yes, use:
ALTER DATABASE MyDB
SET RESTRICTED_USER
WITH ROLLBACK IMMEDIATE
That kicks out the users and makes the DB available only to admins - only
members of the db_owner, dbcreator, or sysadmin roles.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Will" <wfj5444@.gmail.com> wrote in message
news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
Yes it is the first, the table will be corrupted causing an issue for
one type of data.
When this happens, we have to clean the table and let the app recreate
an empty version.
Sorry you refer to your former method, which method? The ALTER DB
example from above?
Tom Moreau wrote:
> Is it that just this one table will be "corrupt" or will other tables get
> corrupted as well? If it's the former, my previous method will handle it.
> If it's the later, I'd be tempted to shut down the middle tier, but
> putting
> the DB into single user mode (and killing any running connections to that
> DB) would do so as well. Check out the BOL for ALTER DATABASE.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> Ah, before I do that let me confirm that you are correct this is an
> application issue.
> Since this is a boxed application, I do not want to change how it
> handles this table.
> Do you see any other ways to work around the problem?
>
> Tom Moreau wrote:
> > If the table is getting corrupted, then it's possible that the app is
> > not
> > properly designed. We'd have to know more first. You could start a
> > transaction and:
> >
> > 1) begin a transaction
> > 2) do a SELECT on the table with TABLOCKX
> > 3) do the backup
> > 4) rollback the transaction
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > <wfj5444@.gmail.com> wrote in message
> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> > Thanks Tom.
> >
> > The reason is due to a specific table that gets corrupted if users are
> > accessing it during backup.
> >
> > I can not think of more simple solution than going single user, backing
> > it up and then returning to multi user.
> >
> >
> >
> >
> > Tom Moreau wrote:
> > > Basically, check out the following in the BOL:
> > >
> > > ALTER DATABASE
> > > BACKUP DATABASE
> > > sp_add_job
> > > sp_add_jobstep
> > >
> > > Also, I am curious as to why single-user mode is a requirement.
> > >
> > > --
> > > Tom
> > >
> > > ----
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > SQL Server MVP
> > > Toronto, ON Canada
> > > .
> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> > > Tom,
> > > is there any refrences on your method, in online books or on the web.
> > > Thanks
> > >
> > > "Tom Moreau" wrote:
> > >
> > > > Why is single-user mode a requirement?
> > > >
> > > > That said, you can eschew the maintenance plan and just script out
> > > > the
> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> > > >
> > > > --
> > > > Tom
> > > >
> > > > ----
> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > > SQL Server MVP
> > > > Toronto, ON Canada
> > > > ..
> > > > <wfj5444@.gmail.com> wrote in message
> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > > > I am trying to come up with the best solution for the following
> > > > issue:
> > > >
> > > > I have a specific DB that needs to be backed up in single user mode.
> > > > I
> > > > want to do this with a a Maitenance Plan but I am not sure if that
> > > > is
> > > > possible or makes sense.
> > > >
> > > > What are my options? Do I have to backup with a script? I would
> > > > like
> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> > > >
> > > > Thanks for the help.
> > > >
> > > >|||"Will" <wfj5444@.gmail.com> wrote in message
news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> Yes it is the first, the table will be corrupted causing an issue for
> one type of data.
Then call the company that wrote this POS and complain.
SQL Server is designed for online backups. Hell, it would be impossible for
many major websites to work w/o that feature.
> When this happens, we have to clean the table and let the app recreate
> an empty version.
> Sorry you refer to your former method, which method? The ALTER DB
> example from above?
> Tom Moreau wrote:
> > Is it that just this one table will be "corrupt" or will other tables
get
> > corrupted as well? If it's the former, my previous method will handle
it.
> > If it's the later, I'd be tempted to shut down the middle tier, but
putting
> > the DB into single user mode (and killing any running connections to
that
> > DB) would do so as well. Check out the BOL for ALTER DATABASE.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > "Will" <wfj5444@.gmail.com> wrote in message
> > news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> > Ah, before I do that let me confirm that you are correct this is an
> > application issue.
> > Since this is a boxed application, I do not want to change how it
> > handles this table.
> >
> > Do you see any other ways to work around the problem?
> >
> >
> > Tom Moreau wrote:
> > > If the table is getting corrupted, then it's possible that the app is
not
> > > properly designed. We'd have to know more first. You could start a
> > > transaction and:
> > >
> > > 1) begin a transaction
> > > 2) do a SELECT on the table with TABLOCKX
> > > 3) do the backup
> > > 4) rollback the transaction
> > >
> > > --
> > > Tom
> > >
> > > ----
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > SQL Server MVP
> > > Toronto, ON Canada
> > > .
> > > <wfj5444@.gmail.com> wrote in message
> > > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> > > Thanks Tom.
> > >
> > > The reason is due to a specific table that gets corrupted if users are
> > > accessing it during backup.
> > >
> > > I can not think of more simple solution than going single user,
backing
> > > it up and then returning to multi user.
> > >
> > >
> > >
> > >
> > > Tom Moreau wrote:
> > > > Basically, check out the following in the BOL:
> > > >
> > > > ALTER DATABASE
> > > > BACKUP DATABASE
> > > > sp_add_job
> > > > sp_add_jobstep
> > > >
> > > > Also, I am curious as to why single-user mode is a requirement.
> > > >
> > > > --
> > > > Tom
> > > >
> > > > ----
> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > > SQL Server MVP
> > > > Toronto, ON Canada
> > > > .
> > > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> > > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> > > > Tom,
> > > > is there any refrences on your method, in online books or on the
web.
> > > > Thanks
> > > >
> > > > "Tom Moreau" wrote:
> > > >
> > > > > Why is single-user mode a requirement?
> > > > >
> > > > > That said, you can eschew the maintenance plan and just script out
the
> > > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> > > > >
> > > > > --
> > > > > Tom
> > > > >
> > > > > ----
> > > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > > > > SQL Server MVP
> > > > > Toronto, ON Canada
> > > > > ..
> > > > > <wfj5444@.gmail.com> wrote in message
> > > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> > > > > I am trying to come up with the best solution for the following
issue:
> > > > >
> > > > > I have a specific DB that needs to be backed up in single user
mode.
> > > > > I
> > > > > want to do this with a a Maitenance Plan but I am not sure if that
is
> > > > > possible or makes sense.
> > > > >
> > > > > What are my options? Do I have to backup with a script? I would
like
> > > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> > > > >
> > > > > Thanks for the help.
> > > > >
> > > > >
>|||> That kicks out the users and makes the DB available only to admins - only
> members of the db_owner, dbcreator, or sysadmin roles.
But wouldn't end result be the same as if you just did a backup with the users connected? Here's my
reasoning:
The app "doesn't support online backup". Now, why is that? Probably because they don't have correct
transaction handling. The backup can grab some data for an operation which isn't done yet, just
because the developers didn't wrap that operation in a transaction.
Now, kicking out the users will do the very same thing. Remember that backup gives us the database
as a snapshot in time (I know you know this, Tom...).
It sounds like the software vendor has produced and sell an application which doesn't allow you to
perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor and ask
them for the technical reason why a normal backup operation won't do and also ask them in what way
kicking out the users would make a difference.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
> Yes, use:
> ALTER DATABASE MyDB
> SET RESTRICTED_USER
> WITH ROLLBACK IMMEDIATE
> That kicks out the users and makes the DB available only to admins - only
> members of the db_owner, dbcreator, or sysadmin roles.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> Yes it is the first, the table will be corrupted causing an issue for
> one type of data.
> When this happens, we have to clean the table and let the app recreate
> an empty version.
> Sorry you refer to your former method, which method? The ALTER DB
> example from above?
> Tom Moreau wrote:
>> Is it that just this one table will be "corrupt" or will other tables get
>> corrupted as well? If it's the former, my previous method will handle it.
>> If it's the later, I'd be tempted to shut down the middle tier, but
>> putting
>> the DB into single user mode (and killing any running connections to that
>> DB) would do so as well. Check out the BOL for ALTER DATABASE.
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Toronto, ON Canada
>> .
>> "Will" <wfj5444@.gmail.com> wrote in message
>> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
>> Ah, before I do that let me confirm that you are correct this is an
>> application issue.
>> Since this is a boxed application, I do not want to change how it
>> handles this table.
>> Do you see any other ways to work around the problem?
>>
>> Tom Moreau wrote:
>> > If the table is getting corrupted, then it's possible that the app is
>> > not
>> > properly designed. We'd have to know more first. You could start a
>> > transaction and:
>> >
>> > 1) begin a transaction
>> > 2) do a SELECT on the table with TABLOCKX
>> > 3) do the backup
>> > 4) rollback the transaction
>> >
>> > --
>> > Tom
>> >
>> > ----
>> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > SQL Server MVP
>> > Toronto, ON Canada
>> > .
>> > <wfj5444@.gmail.com> wrote in message
>> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
>> > Thanks Tom.
>> >
>> > The reason is due to a specific table that gets corrupted if users are
>> > accessing it during backup.
>> >
>> > I can not think of more simple solution than going single user, backing
>> > it up and then returning to multi user.
>> >
>> >
>> >
>> >
>> > Tom Moreau wrote:
>> > > Basically, check out the following in the BOL:
>> > >
>> > > ALTER DATABASE
>> > > BACKUP DATABASE
>> > > sp_add_job
>> > > sp_add_jobstep
>> > >
>> > > Also, I am curious as to why single-user mode is a requirement.
>> > >
>> > > --
>> > > Tom
>> > >
>> > > ----
>> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > > SQL Server MVP
>> > > Toronto, ON Canada
>> > > .
>> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
>> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
>> > > Tom,
>> > > is there any refrences on your method, in online books or on the web.
>> > > Thanks
>> > >
>> > > "Tom Moreau" wrote:
>> > >
>> > > > Why is single-user mode a requirement?
>> > > >
>> > > > That said, you can eschew the maintenance plan and just script out
>> > > > the
>> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
>> > > >
>> > > > --
>> > > > Tom
>> > > >
>> > > > ----
>> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > > > SQL Server MVP
>> > > > Toronto, ON Canada
>> > > > ..
>> > > > <wfj5444@.gmail.com> wrote in message
>> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
>> > > > I am trying to come up with the best solution for the following
>> > > > issue:
>> > > >
>> > > > I have a specific DB that needs to be backed up in single user mode.
>> > > > I
>> > > > want to do this with a a Maitenance Plan but I am not sure if that
>> > > > is
>> > > > possible or makes sense.
>> > > >
>> > > > What are my options? Do I have to backup with a script? I would
>> > > > like
>> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
>> > > >
>> > > > Thanks for the help.
>> > > >
>> > > >
>|||Yes, this does sound like a very strange app.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:ewInsYQlGHA.1664@.TK2MSFTNGP03.phx.gbl...
> That kicks out the users and makes the DB available only to admins - only
> members of the db_owner, dbcreator, or sysadmin roles.
But wouldn't end result be the same as if you just did a backup with the
users connected? Here's my
reasoning:
The app "doesn't support online backup". Now, why is that? Probably because
they don't have correct
transaction handling. The backup can grab some data for an operation which
isn't done yet, just
because the developers didn't wrap that operation in a transaction.
Now, kicking out the users will do the very same thing. Remember that backup
gives us the database
as a snapshot in time (I know you know this, Tom...).
It sounds like the software vendor has produced and sell an application
which doesn't allow you to
perform backup of the data. Indeed worrying! I'd have a very serious talk to
the app vendor and ask
them for the technical reason why a normal backup operation won't do and
also ask them in what way
kicking out the users would make a difference.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
> Yes, use:
> ALTER DATABASE MyDB
> SET RESTRICTED_USER
> WITH ROLLBACK IMMEDIATE
> That kicks out the users and makes the DB available only to admins - only
> members of the db_owner, dbcreator, or sysadmin roles.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> Yes it is the first, the table will be corrupted causing an issue for
> one type of data.
> When this happens, we have to clean the table and let the app recreate
> an empty version.
> Sorry you refer to your former method, which method? The ALTER DB
> example from above?
> Tom Moreau wrote:
>> Is it that just this one table will be "corrupt" or will other tables get
>> corrupted as well? If it's the former, my previous method will handle
>> it.
>> If it's the later, I'd be tempted to shut down the middle tier, but
>> putting
>> the DB into single user mode (and killing any running connections to that
>> DB) would do so as well. Check out the BOL for ALTER DATABASE.
>> --
>> Tom
>> ----
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> SQL Server MVP
>> Toronto, ON Canada
>> .
>> "Will" <wfj5444@.gmail.com> wrote in message
>> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
>> Ah, before I do that let me confirm that you are correct this is an
>> application issue.
>> Since this is a boxed application, I do not want to change how it
>> handles this table.
>> Do you see any other ways to work around the problem?
>>
>> Tom Moreau wrote:
>> > If the table is getting corrupted, then it's possible that the app is
>> > not
>> > properly designed. We'd have to know more first. You could start a
>> > transaction and:
>> >
>> > 1) begin a transaction
>> > 2) do a SELECT on the table with TABLOCKX
>> > 3) do the backup
>> > 4) rollback the transaction
>> >
>> > --
>> > Tom
>> >
>> > ----
>> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > SQL Server MVP
>> > Toronto, ON Canada
>> > .
>> > <wfj5444@.gmail.com> wrote in message
>> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
>> > Thanks Tom.
>> >
>> > The reason is due to a specific table that gets corrupted if users are
>> > accessing it during backup.
>> >
>> > I can not think of more simple solution than going single user, backing
>> > it up and then returning to multi user.
>> >
>> >
>> >
>> >
>> > Tom Moreau wrote:
>> > > Basically, check out the following in the BOL:
>> > >
>> > > ALTER DATABASE
>> > > BACKUP DATABASE
>> > > sp_add_job
>> > > sp_add_jobstep
>> > >
>> > > Also, I am curious as to why single-user mode is a requirement.
>> > >
>> > > --
>> > > Tom
>> > >
>> > > ----
>> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > > SQL Server MVP
>> > > Toronto, ON Canada
>> > > .
>> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
>> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
>> > > Tom,
>> > > is there any refrences on your method, in online books or on the web.
>> > > Thanks
>> > >
>> > > "Tom Moreau" wrote:
>> > >
>> > > > Why is single-user mode a requirement?
>> > > >
>> > > > That said, you can eschew the maintenance plan and just script out
>> > > > the
>> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
>> > > >
>> > > > --
>> > > > Tom
>> > > >
>> > > > ----
>> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > > > SQL Server MVP
>> > > > Toronto, ON Canada
>> > > > ..
>> > > > <wfj5444@.gmail.com> wrote in message
>> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
>> > > > I am trying to come up with the best solution for the following
>> > > > issue:
>> > > >
>> > > > I have a specific DB that needs to be backed up in single user
>> > > > mode.
>> > > > I
>> > > > want to do this with a a Maitenance Plan but I am not sure if that
>> > > > is
>> > > > possible or makes sense.
>> > > >
>> > > > What are my options? Do I have to backup with a script? I would
>> > > > like
>> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
>> > > >
>> > > > Thanks for the help.
>> > > >
>> > > >
>|||Sassan,
It is part of the maintenance plan. We do optimize (remove unused
space) but that is all no other fixing.
Corruption is determined by certain data is missing.
With a checktable there are no errors
We are at build 2187
Sassan Karai wrote:
> I noticed you mention corruption in a particular table - after taking the
> backup
> - is the backup part of a maintenance plan?
> If so does the maintenance plan perform integrity check/repair and or
> optimization before backup.
> - How do you determine corruption of your table afterwards.
> - What errors do you get when you run dbcc checkdb or checktable?
> When you run select @.@.version what SQL build number are you on?
>
> "wfj5444@.gmail.com" wrote:
> > I am trying to come up with the best solution for the following issue:
> >
> > I have a specific DB that needs to be backed up in single user mode. I
> > want to do this with a a Maitenance Plan but I am not sure if that is
> > possible or makes sense.
> >
> > What are my options? Do I have to backup with a script? I would like
> > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >
> > Thanks for the help.
> >
> >|||Greg and Tibor
Greg - We have and they know it is an issue. It is only this specific
table that has the issue.
Tibor - I actually want to make it single user rather than restricted
user. Would that not solve the issue?
The app does support online backup. This is a bug and something they
are going to fix.
Tibor Karaszi wrote:
> > That kicks out the users and makes the DB available only to admins - only
> > members of the db_owner, dbcreator, or sysadmin roles.
> But wouldn't end result be the same as if you just did a backup with the users connected? Here's my
> reasoning:
> The app "doesn't support online backup". Now, why is that? Probably because they don't have correct
> transaction handling. The backup can grab some data for an operation which isn't done yet, just
> because the developers didn't wrap that operation in a transaction.
> Now, kicking out the users will do the very same thing. Remember that backup gives us the database
> as a snapshot in time (I know you know this, Tom...).
> It sounds like the software vendor has produced and sell an application which doesn't allow you to
> perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor and ask
> them for the technical reason why a normal backup operation won't do and also ask them in what way
> kicking out the users would make a difference.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
> > Yes, use:
> >
> > ALTER DATABASE MyDB
> > SET RESTRICTED_USER
> > WITH ROLLBACK IMMEDIATE
> >
> > That kicks out the users and makes the DB available only to admins - only
> > members of the db_owner, dbcreator, or sysadmin roles.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > "Will" <wfj5444@.gmail.com> wrote in message
> > news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> > Yes it is the first, the table will be corrupted causing an issue for
> > one type of data.
> >
> > When this happens, we have to clean the table and let the app recreate
> > an empty version.
> >
> > Sorry you refer to your former method, which method? The ALTER DB
> > example from above?
> >
> > Tom Moreau wrote:
> >> Is it that just this one table will be "corrupt" or will other tables get
> >> corrupted as well? If it's the former, my previous method will handle it.
> >> If it's the later, I'd be tempted to shut down the middle tier, but
> >> putting
> >> the DB into single user mode (and killing any running connections to that
> >> DB) would do so as well. Check out the BOL for ALTER DATABASE.
> >>
> >> --
> >> Tom
> >>
> >> ----
> >> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> SQL Server MVP
> >> Toronto, ON Canada
> >> .
> >> "Will" <wfj5444@.gmail.com> wrote in message
> >> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> >> Ah, before I do that let me confirm that you are correct this is an
> >> application issue.
> >> Since this is a boxed application, I do not want to change how it
> >> handles this table.
> >>
> >> Do you see any other ways to work around the problem?
> >>
> >>
> >> Tom Moreau wrote:
> >> > If the table is getting corrupted, then it's possible that the app is
> >> > not
> >> > properly designed. We'd have to know more first. You could start a
> >> > transaction and:
> >> >
> >> > 1) begin a transaction
> >> > 2) do a SELECT on the table with TABLOCKX
> >> > 3) do the backup
> >> > 4) rollback the transaction
> >> >
> >> > --
> >> > Tom
> >> >
> >> > ----
> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> > SQL Server MVP
> >> > Toronto, ON Canada
> >> > .
> >> > <wfj5444@.gmail.com> wrote in message
> >> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> >> > Thanks Tom.
> >> >
> >> > The reason is due to a specific table that gets corrupted if users are
> >> > accessing it during backup.
> >> >
> >> > I can not think of more simple solution than going single user, backing
> >> > it up and then returning to multi user.
> >> >
> >> >
> >> >
> >> >
> >> > Tom Moreau wrote:
> >> > > Basically, check out the following in the BOL:
> >> > >
> >> > > ALTER DATABASE
> >> > > BACKUP DATABASE
> >> > > sp_add_job
> >> > > sp_add_jobstep
> >> > >
> >> > > Also, I am curious as to why single-user mode is a requirement.
> >> > >
> >> > > --
> >> > > Tom
> >> > >
> >> > > ----
> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> > > SQL Server MVP
> >> > > Toronto, ON Canada
> >> > > .
> >> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> >> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> >> > > Tom,
> >> > > is there any refrences on your method, in online books or on the web.
> >> > > Thanks
> >> > >
> >> > > "Tom Moreau" wrote:
> >> > >
> >> > > > Why is single-user mode a requirement?
> >> > > >
> >> > > > That said, you can eschew the maintenance plan and just script out
> >> > > > the
> >> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> >> > > >
> >> > > > --
> >> > > > Tom
> >> > > >
> >> > > > ----
> >> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> > > > SQL Server MVP
> >> > > > Toronto, ON Canada
> >> > > > ..
> >> > > > <wfj5444@.gmail.com> wrote in message
> >> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> >> > > > I am trying to come up with the best solution for the following
> >> > > > issue:
> >> > > >
> >> > > > I have a specific DB that needs to be backed up in single user mode.
> >> > > > I
> >> > > > want to do this with a a Maitenance Plan but I am not sure if that
> >> > > > is
> >> > > > possible or makes sense.
> >> > > >
> >> > > > What are my options? Do I have to backup with a script? I would
> >> > > > like
> >> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >> > > >
> >> > > > Thanks for the help.
> >> > > >
> >> > > >
> >|||> Tibor - I actually want to make it single user rather than restricted
> user. Would that not solve the issue?
Not the one I was getting at. If the problem is as I described, the application does several things
that should be all or nothing, but not transaction protected, so you go in and grab the data while
this is running, then kicking out users will be no different from just doing a database backup.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Will" <wfj5444@.gmail.com> wrote in message
news:1150891303.954334.46680@.y41g2000cwy.googlegroups.com...
> Greg and Tibor
> Greg - We have and they know it is an issue. It is only this specific
> table that has the issue.
> Tibor - I actually want to make it single user rather than restricted
> user. Would that not solve the issue?
> The app does support online backup. This is a bug and something they
> are going to fix.
>
> Tibor Karaszi wrote:
>> > That kicks out the users and makes the DB available only to admins - only
>> > members of the db_owner, dbcreator, or sysadmin roles.
>> But wouldn't end result be the same as if you just did a backup with the users connected? Here's
>> my
>> reasoning:
>> The app "doesn't support online backup". Now, why is that? Probably because they don't have
>> correct
>> transaction handling. The backup can grab some data for an operation which isn't done yet, just
>> because the developers didn't wrap that operation in a transaction.
>> Now, kicking out the users will do the very same thing. Remember that backup gives us the
>> database
>> as a snapshot in time (I know you know this, Tom...).
>> It sounds like the software vendor has produced and sell an application which doesn't allow you
>> to
>> perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor and
>> ask
>> them for the technical reason why a normal backup operation won't do and also ask them in what
>> way
>> kicking out the users would make a difference.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
>> news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
>> > Yes, use:
>> >
>> > ALTER DATABASE MyDB
>> > SET RESTRICTED_USER
>> > WITH ROLLBACK IMMEDIATE
>> >
>> > That kicks out the users and makes the DB available only to admins - only
>> > members of the db_owner, dbcreator, or sysadmin roles.
>> >
>> > --
>> > Tom
>> >
>> > ----
>> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> > SQL Server MVP
>> > Toronto, ON Canada
>> > .
>> > "Will" <wfj5444@.gmail.com> wrote in message
>> > news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
>> > Yes it is the first, the table will be corrupted causing an issue for
>> > one type of data.
>> >
>> > When this happens, we have to clean the table and let the app recreate
>> > an empty version.
>> >
>> > Sorry you refer to your former method, which method? The ALTER DB
>> > example from above?
>> >
>> > Tom Moreau wrote:
>> >> Is it that just this one table will be "corrupt" or will other tables get
>> >> corrupted as well? If it's the former, my previous method will handle it.
>> >> If it's the later, I'd be tempted to shut down the middle tier, but
>> >> putting
>> >> the DB into single user mode (and killing any running connections to that
>> >> DB) would do so as well. Check out the BOL for ALTER DATABASE.
>> >>
>> >> --
>> >> Tom
>> >>
>> >> ----
>> >> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> SQL Server MVP
>> >> Toronto, ON Canada
>> >> .
>> >> "Will" <wfj5444@.gmail.com> wrote in message
>> >> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
>> >> Ah, before I do that let me confirm that you are correct this is an
>> >> application issue.
>> >> Since this is a boxed application, I do not want to change how it
>> >> handles this table.
>> >>
>> >> Do you see any other ways to work around the problem?
>> >>
>> >>
>> >> Tom Moreau wrote:
>> >> > If the table is getting corrupted, then it's possible that the app is
>> >> > not
>> >> > properly designed. We'd have to know more first. You could start a
>> >> > transaction and:
>> >> >
>> >> > 1) begin a transaction
>> >> > 2) do a SELECT on the table with TABLOCKX
>> >> > 3) do the backup
>> >> > 4) rollback the transaction
>> >> >
>> >> > --
>> >> > Tom
>> >> >
>> >> > ----
>> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> > SQL Server MVP
>> >> > Toronto, ON Canada
>> >> > .
>> >> > <wfj5444@.gmail.com> wrote in message
>> >> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
>> >> > Thanks Tom.
>> >> >
>> >> > The reason is due to a specific table that gets corrupted if users are
>> >> > accessing it during backup.
>> >> >
>> >> > I can not think of more simple solution than going single user, backing
>> >> > it up and then returning to multi user.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > Tom Moreau wrote:
>> >> > > Basically, check out the following in the BOL:
>> >> > >
>> >> > > ALTER DATABASE
>> >> > > BACKUP DATABASE
>> >> > > sp_add_job
>> >> > > sp_add_jobstep
>> >> > >
>> >> > > Also, I am curious as to why single-user mode is a requirement.
>> >> > >
>> >> > > --
>> >> > > Tom
>> >> > >
>> >> > > ----
>> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> > > SQL Server MVP
>> >> > > Toronto, ON Canada
>> >> > > .
>> >> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
>> >> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
>> >> > > Tom,
>> >> > > is there any refrences on your method, in online books or on the web.
>> >> > > Thanks
>> >> > >
>> >> > > "Tom Moreau" wrote:
>> >> > >
>> >> > > > Why is single-user mode a requirement?
>> >> > > >
>> >> > > > That said, you can eschew the maintenance plan and just script out
>> >> > > > the
>> >> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
>> >> > > >
>> >> > > > --
>> >> > > > Tom
>> >> > > >
>> >> > > > ----
>> >> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> > > > SQL Server MVP
>> >> > > > Toronto, ON Canada
>> >> > > > ..
>> >> > > > <wfj5444@.gmail.com> wrote in message
>> >> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
>> >> > > > I am trying to come up with the best solution for the following
>> >> > > > issue:
>> >> > > >
>> >> > > > I have a specific DB that needs to be backed up in single user mode.
>> >> > > > I
>> >> > > > want to do this with a a Maitenance Plan but I am not sure if that
>> >> > > > is
>> >> > > > possible or makes sense.
>> >> > > >
>> >> > > > What are my options? Do I have to backup with a script? I would
>> >> > > > like
>> >> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
>> >> > > >
>> >> > > > Thanks for the help.
>> >> > > >
>> >> > > >
>> >
>|||That confuses me somewhat because the maker's work around is to close
all open instances of this application then back up that one table.
Wouldn't going to single user mode achieve the same thing?
Tibor Karaszi wrote:
> > Tibor - I actually want to make it single user rather than restricted
> > user. Would that not solve the issue?
> Not the one I was getting at. If the problem is as I described, the application does several things
> that should be all or nothing, but not transaction protected, so you go in and grab the data while
> this is running, then kicking out users will be no different from just doing a database backup.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150891303.954334.46680@.y41g2000cwy.googlegroups.com...
> > Greg and Tibor
> >
> > Greg - We have and they know it is an issue. It is only this specific
> > table that has the issue.
> >
> > Tibor - I actually want to make it single user rather than restricted
> > user. Would that not solve the issue?
> >
> > The app does support online backup. This is a bug and something they
> > are going to fix.
> >
> >
> >
> > Tibor Karaszi wrote:
> >> > That kicks out the users and makes the DB available only to admins - only
> >> > members of the db_owner, dbcreator, or sysadmin roles.
> >>
> >> But wouldn't end result be the same as if you just did a backup with the users connected? Here's
> >> my
> >> reasoning:
> >>
> >> The app "doesn't support online backup". Now, why is that? Probably because they don't have
> >> correct
> >> transaction handling. The backup can grab some data for an operation which isn't done yet, just
> >> because the developers didn't wrap that operation in a transaction.
> >>
> >> Now, kicking out the users will do the very same thing. Remember that backup gives us the
> >> database
> >> as a snapshot in time (I know you know this, Tom...).
> >>
> >> It sounds like the software vendor has produced and sell an application which doesn't allow you
> >> to
> >> perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor and
> >> ask
> >> them for the technical reason why a normal backup operation won't do and also ask them in what
> >> way
> >> kicking out the users would make a difference.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> >> news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
> >> > Yes, use:
> >> >
> >> > ALTER DATABASE MyDB
> >> > SET RESTRICTED_USER
> >> > WITH ROLLBACK IMMEDIATE
> >> >
> >> > That kicks out the users and makes the DB available only to admins - only
> >> > members of the db_owner, dbcreator, or sysadmin roles.
> >> >
> >> > --
> >> > Tom
> >> >
> >> > ----
> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> > SQL Server MVP
> >> > Toronto, ON Canada
> >> > .
> >> > "Will" <wfj5444@.gmail.com> wrote in message
> >> > news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> >> > Yes it is the first, the table will be corrupted causing an issue for
> >> > one type of data.
> >> >
> >> > When this happens, we have to clean the table and let the app recreate
> >> > an empty version.
> >> >
> >> > Sorry you refer to your former method, which method? The ALTER DB
> >> > example from above?
> >> >
> >> > Tom Moreau wrote:
> >> >> Is it that just this one table will be "corrupt" or will other tables get
> >> >> corrupted as well? If it's the former, my previous method will handle it.
> >> >> If it's the later, I'd be tempted to shut down the middle tier, but
> >> >> putting
> >> >> the DB into single user mode (and killing any running connections to that
> >> >> DB) would do so as well. Check out the BOL for ALTER DATABASE.
> >> >>
> >> >> --
> >> >> Tom
> >> >>
> >> >> ----
> >> >> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> SQL Server MVP
> >> >> Toronto, ON Canada
> >> >> .
> >> >> "Will" <wfj5444@.gmail.com> wrote in message
> >> >> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> >> >> Ah, before I do that let me confirm that you are correct this is an
> >> >> application issue.
> >> >> Since this is a boxed application, I do not want to change how it
> >> >> handles this table.
> >> >>
> >> >> Do you see any other ways to work around the problem?
> >> >>
> >> >>
> >> >> Tom Moreau wrote:
> >> >> > If the table is getting corrupted, then it's possible that the app is
> >> >> > not
> >> >> > properly designed. We'd have to know more first. You could start a
> >> >> > transaction and:
> >> >> >
> >> >> > 1) begin a transaction
> >> >> > 2) do a SELECT on the table with TABLOCKX
> >> >> > 3) do the backup
> >> >> > 4) rollback the transaction
> >> >> >
> >> >> > --
> >> >> > Tom
> >> >> >
> >> >> > ----
> >> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> > SQL Server MVP
> >> >> > Toronto, ON Canada
> >> >> > .
> >> >> > <wfj5444@.gmail.com> wrote in message
> >> >> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> >> >> > Thanks Tom.
> >> >> >
> >> >> > The reason is due to a specific table that gets corrupted if users are
> >> >> > accessing it during backup.
> >> >> >
> >> >> > I can not think of more simple solution than going single user, backing
> >> >> > it up and then returning to multi user.
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > Tom Moreau wrote:
> >> >> > > Basically, check out the following in the BOL:
> >> >> > >
> >> >> > > ALTER DATABASE
> >> >> > > BACKUP DATABASE
> >> >> > > sp_add_job
> >> >> > > sp_add_jobstep
> >> >> > >
> >> >> > > Also, I am curious as to why single-user mode is a requirement.
> >> >> > >
> >> >> > > --
> >> >> > > Tom
> >> >> > >
> >> >> > > ----
> >> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> > > SQL Server MVP
> >> >> > > Toronto, ON Canada
> >> >> > > .
> >> >> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> >> >> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> >> >> > > Tom,
> >> >> > > is there any refrences on your method, in online books or on the web.
> >> >> > > Thanks
> >> >> > >
> >> >> > > "Tom Moreau" wrote:
> >> >> > >
> >> >> > > > Why is single-user mode a requirement?
> >> >> > > >
> >> >> > > > That said, you can eschew the maintenance plan and just script out
> >> >> > > > the
> >> >> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> >> >> > > >
> >> >> > > > --
> >> >> > > > Tom
> >> >> > > >
> >> >> > > > ----
> >> >> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> > > > SQL Server MVP
> >> >> > > > Toronto, ON Canada
> >> >> > > > ..
> >> >> > > > <wfj5444@.gmail.com> wrote in message
> >> >> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> >> >> > > > I am trying to come up with the best solution for the following
> >> >> > > > issue:
> >> >> > > >
> >> >> > > > I have a specific DB that needs to be backed up in single user mode.
> >> >> > > > I
> >> >> > > > want to do this with a a Maitenance Plan but I am not sure if that
> >> >> > > > is
> >> >> > > > possible or makes sense.
> >> >> > > >
> >> >> > > > What are my options? Do I have to backup with a script? I would
> >> >> > > > like
> >> >> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >> >> > > >
> >> >> > > > Thanks for the help.
> >> >> > > >
> >> >> > > >
> >> >
> >|||Closing the application in a controlled manner is different from kicking out the users from the
database. This is a very important difference. Kicking out the users will leave you with same effect
as just doing a backup. Do what the vendor say and push the vendor for writing a proper application
that support doing backup the same way as the rest of us do :-).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Will" <wfj5444@.gmail.com> wrote in message
news:1150914720.910034.267610@.c74g2000cwc.googlegroups.com...
> That confuses me somewhat because the maker's work around is to close
> all open instances of this application then back up that one table.
> Wouldn't going to single user mode achieve the same thing?
> Tibor Karaszi wrote:
>> > Tibor - I actually want to make it single user rather than restricted
>> > user. Would that not solve the issue?
>> Not the one I was getting at. If the problem is as I described, the application does several
>> things
>> that should be all or nothing, but not transaction protected, so you go in and grab the data
>> while
>> this is running, then kicking out users will be no different from just doing a database backup.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "Will" <wfj5444@.gmail.com> wrote in message
>> news:1150891303.954334.46680@.y41g2000cwy.googlegroups.com...
>> > Greg and Tibor
>> >
>> > Greg - We have and they know it is an issue. It is only this specific
>> > table that has the issue.
>> >
>> > Tibor - I actually want to make it single user rather than restricted
>> > user. Would that not solve the issue?
>> >
>> > The app does support online backup. This is a bug and something they
>> > are going to fix.
>> >
>> >
>> >
>> > Tibor Karaszi wrote:
>> >> > That kicks out the users and makes the DB available only to admins - only
>> >> > members of the db_owner, dbcreator, or sysadmin roles.
>> >>
>> >> But wouldn't end result be the same as if you just did a backup with the users connected?
>> >> Here's
>> >> my
>> >> reasoning:
>> >>
>> >> The app "doesn't support online backup". Now, why is that? Probably because they don't have
>> >> correct
>> >> transaction handling. The backup can grab some data for an operation which isn't done yet,
>> >> just
>> >> because the developers didn't wrap that operation in a transaction.
>> >>
>> >> Now, kicking out the users will do the very same thing. Remember that backup gives us the
>> >> database
>> >> as a snapshot in time (I know you know this, Tom...).
>> >>
>> >> It sounds like the software vendor has produced and sell an application which doesn't allow
>> >> you
>> >> to
>> >> perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor
>> >> and
>> >> ask
>> >> them for the technical reason why a normal backup operation won't do and also ask them in what
>> >> way
>> >> kicking out the users would make a difference.
>> >>
>> >> --
>> >> Tibor Karaszi, SQL Server MVP
>> >> http://www.karaszi.com/sqlserver/default.asp
>> >> http://www.solidqualitylearning.com/
>> >>
>> >>
>> >> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
>> >> news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
>> >> > Yes, use:
>> >> >
>> >> > ALTER DATABASE MyDB
>> >> > SET RESTRICTED_USER
>> >> > WITH ROLLBACK IMMEDIATE
>> >> >
>> >> > That kicks out the users and makes the DB available only to admins - only
>> >> > members of the db_owner, dbcreator, or sysadmin roles.
>> >> >
>> >> > --
>> >> > Tom
>> >> >
>> >> > ----
>> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> > SQL Server MVP
>> >> > Toronto, ON Canada
>> >> > .
>> >> > "Will" <wfj5444@.gmail.com> wrote in message
>> >> > news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
>> >> > Yes it is the first, the table will be corrupted causing an issue for
>> >> > one type of data.
>> >> >
>> >> > When this happens, we have to clean the table and let the app recreate
>> >> > an empty version.
>> >> >
>> >> > Sorry you refer to your former method, which method? The ALTER DB
>> >> > example from above?
>> >> >
>> >> > Tom Moreau wrote:
>> >> >> Is it that just this one table will be "corrupt" or will other tables get
>> >> >> corrupted as well? If it's the former, my previous method will handle it.
>> >> >> If it's the later, I'd be tempted to shut down the middle tier, but
>> >> >> putting
>> >> >> the DB into single user mode (and killing any running connections to that
>> >> >> DB) would do so as well. Check out the BOL for ALTER DATABASE.
>> >> >>
>> >> >> --
>> >> >> Tom
>> >> >>
>> >> >> ----
>> >> >> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> >> SQL Server MVP
>> >> >> Toronto, ON Canada
>> >> >> .
>> >> >> "Will" <wfj5444@.gmail.com> wrote in message
>> >> >> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
>> >> >> Ah, before I do that let me confirm that you are correct this is an
>> >> >> application issue.
>> >> >> Since this is a boxed application, I do not want to change how it
>> >> >> handles this table.
>> >> >>
>> >> >> Do you see any other ways to work around the problem?
>> >> >>
>> >> >>
>> >> >> Tom Moreau wrote:
>> >> >> > If the table is getting corrupted, then it's possible that the app is
>> >> >> > not
>> >> >> > properly designed. We'd have to know more first. You could start a
>> >> >> > transaction and:
>> >> >> >
>> >> >> > 1) begin a transaction
>> >> >> > 2) do a SELECT on the table with TABLOCKX
>> >> >> > 3) do the backup
>> >> >> > 4) rollback the transaction
>> >> >> >
>> >> >> > --
>> >> >> > Tom
>> >> >> >
>> >> >> > ----
>> >> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> >> > SQL Server MVP
>> >> >> > Toronto, ON Canada
>> >> >> > .
>> >> >> > <wfj5444@.gmail.com> wrote in message
>> >> >> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
>> >> >> > Thanks Tom.
>> >> >> >
>> >> >> > The reason is due to a specific table that gets corrupted if users are
>> >> >> > accessing it during backup.
>> >> >> >
>> >> >> > I can not think of more simple solution than going single user, backing
>> >> >> > it up and then returning to multi user.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > Tom Moreau wrote:
>> >> >> > > Basically, check out the following in the BOL:
>> >> >> > >
>> >> >> > > ALTER DATABASE
>> >> >> > > BACKUP DATABASE
>> >> >> > > sp_add_job
>> >> >> > > sp_add_jobstep
>> >> >> > >
>> >> >> > > Also, I am curious as to why single-user mode is a requirement.
>> >> >> > >
>> >> >> > > --
>> >> >> > > Tom
>> >> >> > >
>> >> >> > > ----
>> >> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> >> > > SQL Server MVP
>> >> >> > > Toronto, ON Canada
>> >> >> > > .
>> >> >> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
>> >> >> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
>> >> >> > > Tom,
>> >> >> > > is there any refrences on your method, in online books or on the web.
>> >> >> > > Thanks
>> >> >> > >
>> >> >> > > "Tom Moreau" wrote:
>> >> >> > >
>> >> >> > > > Why is single-user mode a requirement?
>> >> >> > > >
>> >> >> > > > That said, you can eschew the maintenance plan and just script out
>> >> >> > > > the
>> >> >> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
>> >> >> > > >
>> >> >> > > > --
>> >> >> > > > Tom
>> >> >> > > >
>> >> >> > > > ----
>> >> >> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>> >> >> > > > SQL Server MVP
>> >> >> > > > Toronto, ON Canada
>> >> >> > > > ..
>> >> >> > > > <wfj5444@.gmail.com> wrote in message
>> >> >> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
>> >> >> > > > I am trying to come up with the best solution for the following
>> >> >> > > > issue:
>> >> >> > > >
>> >> >> > > > I have a specific DB that needs to be backed up in single user mode.
>> >> >> > > > I
>> >> >> > > > want to do this with a a Maitenance Plan but I am not sure if that
>> >> >> > > > is
>> >> >> > > > possible or makes sense.
>> >> >> > > >
>> >> >> > > > What are my options? Do I have to backup with a script? I would
>> >> >> > > > like
>> >> >> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
>> >> >> > > >
>> >> >> > > > Thanks for the help.
>> >> >> > > >
>> >> >> > > >
>> >> >
>> >
>|||Well dang. I was hoping that wasn't the case. I was afraid of where
that was headed.
Thanks,
Will
Tibor Karaszi wrote:
> Closing the application in a controlled manner is different from kicking out the users from the
> database. This is a very important difference. Kicking out the users will leave you with same effect
> as just doing a backup. Do what the vendor say and push the vendor for writing a proper application
> that support doing backup the same way as the rest of us do :-).
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Will" <wfj5444@.gmail.com> wrote in message
> news:1150914720.910034.267610@.c74g2000cwc.googlegroups.com...
> > That confuses me somewhat because the maker's work around is to close
> > all open instances of this application then back up that one table.
> >
> > Wouldn't going to single user mode achieve the same thing?
> >
> > Tibor Karaszi wrote:
> >> > Tibor - I actually want to make it single user rather than restricted
> >> > user. Would that not solve the issue?
> >>
> >> Not the one I was getting at. If the problem is as I described, the application does several
> >> things
> >> that should be all or nothing, but not transaction protected, so you go in and grab the data
> >> while
> >> this is running, then kicking out users will be no different from just doing a database backup.
> >>
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://www.solidqualitylearning.com/
> >>
> >>
> >> "Will" <wfj5444@.gmail.com> wrote in message
> >> news:1150891303.954334.46680@.y41g2000cwy.googlegroups.com...
> >> > Greg and Tibor
> >> >
> >> > Greg - We have and they know it is an issue. It is only this specific
> >> > table that has the issue.
> >> >
> >> > Tibor - I actually want to make it single user rather than restricted
> >> > user. Would that not solve the issue?
> >> >
> >> > The app does support online backup. This is a bug and something they
> >> > are going to fix.
> >> >
> >> >
> >> >
> >> > Tibor Karaszi wrote:
> >> >> > That kicks out the users and makes the DB available only to admins - only
> >> >> > members of the db_owner, dbcreator, or sysadmin roles.
> >> >>
> >> >> But wouldn't end result be the same as if you just did a backup with the users connected?
> >> >> Here's
> >> >> my
> >> >> reasoning:
> >> >>
> >> >> The app "doesn't support online backup". Now, why is that? Probably because they don't have
> >> >> correct
> >> >> transaction handling. The backup can grab some data for an operation which isn't done yet,
> >> >> just
> >> >> because the developers didn't wrap that operation in a transaction.
> >> >>
> >> >> Now, kicking out the users will do the very same thing. Remember that backup gives us the
> >> >> database
> >> >> as a snapshot in time (I know you know this, Tom...).
> >> >>
> >> >> It sounds like the software vendor has produced and sell an application which doesn't allow
> >> >> you
> >> >> to
> >> >> perform backup of the data. Indeed worrying! I'd have a very serious talk to the app vendor
> >> >> and
> >> >> ask
> >> >> them for the technical reason why a normal backup operation won't do and also ask them in what
> >> >> way
> >> >> kicking out the users would make a difference.
> >> >>
> >> >> --
> >> >> Tibor Karaszi, SQL Server MVP
> >> >> http://www.karaszi.com/sqlserver/default.asp
> >> >> http://www.solidqualitylearning.com/
> >> >>
> >> >>
> >> >> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> >> >> news:uVA8pBMlGHA.1640@.TK2MSFTNGP02.phx.gbl...
> >> >> > Yes, use:
> >> >> >
> >> >> > ALTER DATABASE MyDB
> >> >> > SET RESTRICTED_USER
> >> >> > WITH ROLLBACK IMMEDIATE
> >> >> >
> >> >> > That kicks out the users and makes the DB available only to admins - only
> >> >> > members of the db_owner, dbcreator, or sysadmin roles.
> >> >> >
> >> >> > --
> >> >> > Tom
> >> >> >
> >> >> > ----
> >> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> > SQL Server MVP
> >> >> > Toronto, ON Canada
> >> >> > .
> >> >> > "Will" <wfj5444@.gmail.com> wrote in message
> >> >> > news:1150833647.087347.294880@.u72g2000cwu.googlegroups.com...
> >> >> > Yes it is the first, the table will be corrupted causing an issue for
> >> >> > one type of data.
> >> >> >
> >> >> > When this happens, we have to clean the table and let the app recreate
> >> >> > an empty version.
> >> >> >
> >> >> > Sorry you refer to your former method, which method? The ALTER DB
> >> >> > example from above?
> >> >> >
> >> >> > Tom Moreau wrote:
> >> >> >> Is it that just this one table will be "corrupt" or will other tables get
> >> >> >> corrupted as well? If it's the former, my previous method will handle it.
> >> >> >> If it's the later, I'd be tempted to shut down the middle tier, but
> >> >> >> putting
> >> >> >> the DB into single user mode (and killing any running connections to that
> >> >> >> DB) would do so as well. Check out the BOL for ALTER DATABASE.
> >> >> >>
> >> >> >> --
> >> >> >> Tom
> >> >> >>
> >> >> >> ----
> >> >> >> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> >> SQL Server MVP
> >> >> >> Toronto, ON Canada
> >> >> >> .
> >> >> >> "Will" <wfj5444@.gmail.com> wrote in message
> >> >> >> news:1150831918.413415.186750@.h76g2000cwa.googlegroups.com...
> >> >> >> Ah, before I do that let me confirm that you are correct this is an
> >> >> >> application issue.
> >> >> >> Since this is a boxed application, I do not want to change how it
> >> >> >> handles this table.
> >> >> >>
> >> >> >> Do you see any other ways to work around the problem?
> >> >> >>
> >> >> >>
> >> >> >> Tom Moreau wrote:
> >> >> >> > If the table is getting corrupted, then it's possible that the app is
> >> >> >> > not
> >> >> >> > properly designed. We'd have to know more first. You could start a
> >> >> >> > transaction and:
> >> >> >> >
> >> >> >> > 1) begin a transaction
> >> >> >> > 2) do a SELECT on the table with TABLOCKX
> >> >> >> > 3) do the backup
> >> >> >> > 4) rollback the transaction
> >> >> >> >
> >> >> >> > --
> >> >> >> > Tom
> >> >> >> >
> >> >> >> > ----
> >> >> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> >> > SQL Server MVP
> >> >> >> > Toronto, ON Canada
> >> >> >> > .
> >> >> >> > <wfj5444@.gmail.com> wrote in message
> >> >> >> > news:1150830179.091800.37840@.y41g2000cwy.googlegroups.com...
> >> >> >> > Thanks Tom.
> >> >> >> >
> >> >> >> > The reason is due to a specific table that gets corrupted if users are
> >> >> >> > accessing it during backup.
> >> >> >> >
> >> >> >> > I can not think of more simple solution than going single user, backing
> >> >> >> > it up and then returning to multi user.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > Tom Moreau wrote:
> >> >> >> > > Basically, check out the following in the BOL:
> >> >> >> > >
> >> >> >> > > ALTER DATABASE
> >> >> >> > > BACKUP DATABASE
> >> >> >> > > sp_add_job
> >> >> >> > > sp_add_jobstep
> >> >> >> > >
> >> >> >> > > Also, I am curious as to why single-user mode is a requirement.
> >> >> >> > >
> >> >> >> > > --
> >> >> >> > > Tom
> >> >> >> > >
> >> >> >> > > ----
> >> >> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> >> > > SQL Server MVP
> >> >> >> > > Toronto, ON Canada
> >> >> >> > > .
> >> >> >> > > "SQLboston" <SQLboston@.discussions.microsoft.com> wrote in message
> >> >> >> > > news:BF33532D-DDDF-486F-8586-2E01F1753780@.microsoft.com...
> >> >> >> > > Tom,
> >> >> >> > > is there any refrences on your method, in online books or on the web.
> >> >> >> > > Thanks
> >> >> >> > >
> >> >> >> > > "Tom Moreau" wrote:
> >> >> >> > >
> >> >> >> > > > Why is single-user mode a requirement?
> >> >> >> > > >
> >> >> >> > > > That said, you can eschew the maintenance plan and just script out
> >> >> >> > > > the
> >> >> >> > > > ALTER, BACKUP and ALTER steps in a regular SQL Agent job.
> >> >> >> > > >
> >> >> >> > > > --
> >> >> >> > > > Tom
> >> >> >> > > >
> >> >> >> > > > ----
> >> >> >> > > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> >> >> >> > > > SQL Server MVP
> >> >> >> > > > Toronto, ON Canada
> >> >> >> > > > ..
> >> >> >> > > > <wfj5444@.gmail.com> wrote in message
> >> >> >> > > > news:1150811487.949518.264330@.c74g2000cwc.googlegroups.com...
> >> >> >> > > > I am trying to come up with the best solution for the following
> >> >> >> > > > issue:
> >> >> >> > > >
> >> >> >> > > > I have a specific DB that needs to be backed up in single user mode.
> >> >> >> > > > I
> >> >> >> > > > want to do this with a a Maitenance Plan but I am not sure if that
> >> >> >> > > > is
> >> >> >> > > > possible or makes sense.
> >> >> >> > > >
> >> >> >> > > > What are my options? Do I have to backup with a script? I would
> >> >> >> > > > like
> >> >> >> > > > the Maint. Plan to kick off the ALTER DB script to kick out users.
> >> >> >> > > >
> >> >> >> > > > Thanks for the help.
> >> >> >> > > >
> >> >> >> > > >
> >> >> >
> >> >
> >