Friday, March 30, 2012
Scheduling sp_updatestats
Is there a better way to schedule that outside of a maintenance plan ?I prefer to use a SQL Agent Job. Using DTS isn't really necessary (and is
the wrong tool) in 'most' cases.
--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf
"J1C" <just1coder@.yahoo.ca> wrote in message
news:1164670349.026026.226980@.l39g2000cwd.googlegroups.com...
> Any reason NOT to use DTS to execute sp_updatestats on a daily basis?
> Is there a better way to schedule that outside of a maintenance plan ?
>|||Hello,
Why do you need DTS for this. All you have to do is:-
1. Open Enterprise Manager
2. Connect to SQL Server
3. Expand Management, Select Jobs and create new job.
4. In the job step give sp_updatestats and choose database
5. Provide a schedule to execute
6. Save the job
Based on the schedule.. SQL Server agent will trigger this job
Thanks
Hari
"J1C" <just1coder@.yahoo.ca> wrote in message
news:1164670349.026026.226980@.l39g2000cwd.googlegroups.com...
> Any reason NOT to use DTS to execute sp_updatestats on a daily basis?
> Is there a better way to schedule that outside of a maintenance plan ?
>|||Hari Prasad wrote:
> Hello,
> Why do you need DTS for this. All you have to do is:-
> 1. Open Enterprise Manager
> 2. Connect to SQL Server
> 3. Expand Management, Select Jobs and create new job.
> 4. In the job step give sp_updatestats and choose database
> 5. Provide a schedule to execute
> 6. Save the job
> Based on the schedule.. SQL Server agent will trigger this job
> Thanks
> Hari
> "J1C" <just1coder@.yahoo.ca> wrote in message
> news:1164670349.026026.226980@.l39g2000cwd.googlegroups.com...
> > Any reason NOT to use DTS to execute sp_updatestats on a daily basis?
> > Is there a better way to schedule that outside of a maintenance plan ?
> >
Thanks - that is what I ended up doing rather than DTS.
Scheduling Report to render in to PDF format
I have a report with 25 subreports which needs to generate one pdf file on
schedule basis (ie. schedule report to render in to PDF format based on some
time and date setting).
Is there any way of doing this?
Thanks in advance for the helper.
Regards.
AnithaYou need to subscribe to the report. As part of the subscription parameters
you can define the schedule of when you want the report to be automatically
generated.
Keep in mind that you have to also define a dafault value for each parameter
in your report.
Hope this helps,
Tigan
"Anitha Naidu" wrote:
> Hi,
> I have a report with 25 subreports which needs to generate one pdf file on
> schedule basis (ie. schedule report to render in to PDF format based on some
> time and date setting).
> Is there any way of doing this?
> Thanks in advance for the helper.
> Regards.
> Anitha
>
Friday, March 23, 2012
Scheduling a backup
I want to schedule a backup of three databases on a daily basis.
I've written the code to run the 3 backups in TSQL and was wondering how
best to automate this procedure?
Should I put the code in an sproc and then schedule running that command
in the DTS or should I just add the TSQL into a DTS command?? Or is
there a better way of doing this?
I then prefer to use DTSRUNUI to generate the syntax and then schedule
this from the windows scheduler as opposed to the SQL SCheduler in EM
(is this the best way?)
Help would be appreciated
M3ckon
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!"m3ckon" <anonymous@.devdex.com> wrote in message
news:40cdbb60$0$25520$c397aba@.news.newsgroups.ws.. .
> Hi,
> I want to schedule a backup of three databases on a daily basis.
> I've written the code to run the 3 backups in TSQL and was wondering how
> best to automate this procedure?
> Should I put the code in an sproc and then schedule running that command
> in the DTS or should I just add the TSQL into a DTS command?? Or is
> there a better way of doing this?
> I then prefer to use DTSRUNUI to generate the syntax and then schedule
> this from the windows scheduler as opposed to the SQL SCheduler in EM
> (is this the best way?)
> Help would be appreciated
> M3ckon
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!
Putting the code in a procedure may be best, because it's simpler to manage,
and you don't get awkward problems working with EM or other tools which
allow only a very limited area for viewing code. If you're executing a DTS
package, then your geenral approach above seems OK, although the Windows
scheduler is rather limited compared to the MSSQL one, so unless there is a
very good reason not to, I would use the MSSQL scheduler.
Having said all that, using DTS as a backup mechanism is a little unusual,
unless your backups are part of a larger workflow. For simple backups,
maintenance plans are a convenient solution, although since they have some
limitations, you might have to write your own TSQL code sooner or later. But
scheduling a stored procedure in MSSQL is generally less complicated than
scheduling a DTS package, unless you need some extra functionality.
Simon|||Hi
You can do it in serveral ways, but I would control it through a SQL Agent
job. If you run the backup
See sp_add_job, sp_add_jobschedule, and sp_add_jobstep
http://msdn.microsoft.com/library/d...asp?frame=true
If you want see a backup job programmed there is a schedule option at the
bottom of the backup wizard screen in Enterprise Manager.
John
"m3ckon" <anonymous@.devdex.com> wrote in message
news:40cdbb60$0$25520$c397aba@.news.newsgroups.ws.. .
> Hi,
> I want to schedule a backup of three databases on a daily basis.
> I've written the code to run the 3 backups in TSQL and was wondering how
> best to automate this procedure?
> Should I put the code in an sproc and then schedule running that command
> in the DTS or should I just add the TSQL into a DTS command?? Or is
> there a better way of doing this?
> I then prefer to use DTSRUNUI to generate the syntax and then schedule
> this from the windows scheduler as opposed to the SQL SCheduler in EM
> (is this the best way?)
> Help would be appreciated
> M3ckon
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!
Wednesday, March 21, 2012
Scheduled reboot of SQL Server on Windows 2000
Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
there any performance benefits in doing this? Does this help to defragment
memory?
There's no real benefit. However, you will likely incur a performance
penalty each time, since it will have to repopulate the data cache.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Cajun" <Cajun@.discussions.microsoft.com> wrote in message
news:FECF4E55-A44B-42CE-86E0-9D0915BD6490@.microsoft.com...
I am descerning whether it is a good idea (or necessary) to reboot our SQL
Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
there any performance benefits in doing this? Does this help to defragment
memory?
|||Hi -
Experts says :-
"This is a fairly common question, and the answer is fairly straight
forward, no. Assuming you are using Windows NT Server 4.0 SP6a, or Windows
2000 Server SP4, or Windows 2003 Server, and are running SQL Server 7.0 or
2000 (any service packs), there is no reason to automatically reboot your
server. Doing so will not offer you any performance benefits or enhance
reliability.
There is a common myth among many IS people that Windows Server software
needs to be rebooted regularly for it to work efficiently. There may have
been a grain of truth to this in previous versions of Windows NT Server
(before 4.0), but since 4.0, there has not been any need to reboot Windows
Server on a regular basis.
I have seen many, many Windows servers that are virtually never rebooted,
and they never have any problems due to the OS.
On the other hand, I have seen poorly written applications written for
Windows Server that have memory leaks that have force the need to reboot the
server on a regular basis. But this problem is the fault of the application,
not the OS. It is very possible that less knowledgeable IS staff in general
have improperly diagnosed the cause of a server's problem and blamed it on
the OS, and not the application as they should, which is perpetuating this
myth.
Since your SQL Server is not having any problems, leave it alone, and tell
the other people on your staff to stop listening to urban legends."
"Cajun" wrote:
> I am descerning whether it is a good idea (or necessary) to reboot our SQL
> Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
> there any performance benefits in doing this? Does this help to defragment
> memory?
Scheduled reboot of SQL Server on Windows 2000
Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
there any performance benefits in doing this? Does this help to defragment
memory?There's no real benefit. However, you will likely incur a performance
penalty each time, since it will have to repopulate the data cache.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Cajun" <Cajun@.discussions.microsoft.com> wrote in message
news:FECF4E55-A44B-42CE-86E0-9D0915BD6490@.microsoft.com...
I am descerning whether it is a good idea (or necessary) to reboot our SQL
Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
there any performance benefits in doing this? Does this help to defragment
memory?|||Hi -
Experts says :-
"This is a fairly common question, and the answer is fairly straight
forward, no. Assuming you are using Windows NT Server 4.0 SP6a, or Windows
2000 Server SP4, or Windows 2003 Server, and are running SQL Server 7.0 or
2000 (any service packs), there is no reason to automatically reboot your
server. Doing so will not offer you any performance benefits or enhance
reliability.
There is a common myth among many IS people that Windows Server software
needs to be rebooted regularly for it to work efficiently. There may have
been a grain of truth to this in previous versions of Windows NT Server
(before 4.0), but since 4.0, there has not been any need to reboot Windows
Server on a regular basis.
I have seen many, many Windows servers that are virtually never rebooted,
and they never have any problems due to the OS.
On the other hand, I have seen poorly written applications written for
Windows Server that have memory leaks that have force the need to reboot the
server on a regular basis. But this problem is the fault of the application,
not the OS. It is very possible that less knowledgeable IS staff in general
have improperly diagnosed the cause of a server's problem and blamed it on
the OS, and not the application as they should, which is perpetuating this
myth.
Since your SQL Server is not having any problems, leave it alone, and tell
the other people on your staff to stop listening to urban legends."
"Cajun" wrote:
> I am descerning whether it is a good idea (or necessary) to reboot our SQL
> Server 2000 servers on a regular basis (E.g., monthly or quarterly). Are
> there any performance benefits in doing this? Does this help to defragmen
t
> memory?sql
Saturday, February 25, 2012
schedule dbcc indexdefrag every Saturday?
.
every saturday?Schedule through SQL Agent job(s).
You can iterate through the indexes in the system catalog tables/views and
loop through to fire off the defrag, if you do not want to set it up
individuallly.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Mike" wrote:
> How can I set up SQL Server to defragment all indexes on a w
.g.
> every saturday?|||Or use the code already written for us, which also doesn't defrag if the ind
ex isn't fragmented in
the first place. Code found in Books Online, DBCC SHOWCONTIG.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message
news:9B1D603C-F198-4977-A6DC-4203CC13AA5E@.microsoft.com...
> Schedule through SQL Agent job(s).
> You can iterate through the indexes in the system catalog tables/views and
> loop through to fire off the defrag, if you do not want to set it up
> individuallly.
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
>
> "Mike" wrote:
>|||There you go encouraging the use of cursor based progarmming. ;-)
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uu$Y1qujFHA.3316@.TK2MSFTNGP14.phx.gbl...
> Or use the code already written for us, which also doesn't defrag if the
> index isn't fragmented in the first place. Code found in Books Online,
> DBCC SHOWCONTIG.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM>
> wrote in message
> news:9B1D603C-F198-4977-A6DC-4203CC13AA5E@.microsoft.com...
>|||LOL. Do you have a set based approach? ;-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"JT" <someone@.microsoft.com> wrote in message news:ubRC11vjFHA.3336@.tk2msftngp13.phx.gbl...
> There you go encouraging the use of cursor based progarmming. ;-)
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:uu$Y1qujFHA.3316@.TK2MSFTNGP14.phx.gbl...
>|||Below is an example of how some people iterate through a temporary table. It
doesn't run any faster, but at least they have the satisfaction of knowing
they didn't use a cursor. I was once on a project where the lead developer
actually wanted to re-write avoer 20 cursor based stored procedures like so.
Fortunately, management pulled the plug on the project, and I was able to
move on to more meaningful work.
CREATE #temptable
(
id int NOT NULL IDENTITY (1, 1),
. . .
)
. . .
select @.id = select min(id) from #temptable
select @.MAXID = select max(id) from #temptable
WHILE @.id <= @.MAXID
BEGIN
. . .
select @.id = @.id + 1
END
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23ARjZ63jFHA.1504@.TK2MSFTNGP10.phx.gbl...
> LOL. Do you have a set based approach? ;-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "JT" <someone@.microsoft.com> wrote in message
> news:ubRC11vjFHA.3336@.tk2msftngp13.phx.gbl...|||Yes, I have used that technique in version 4.2 (or was it 1.1?), before serv
er side cursors was
introduced. I think the term cursors is misinterpreted/misused, hence the ex
ample you mention
("re-do these cursors to another procedural technique"). I'm glad you didn't
have to do that
conversion... Personally, I prefer a cursor to the looping of temp table app
roach, I find cursor
code more readable. ... In cases like maint scripts, for instance.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"JT" <someone@.microsoft.com> wrote in message news:uLNefYRkFHA.1204@.TK2MSFTNGP12.phx.gbl...
> Below is an example of how some people iterate through a temporary table.
It doesn't run any
> faster, but at least they have the satisfaction of knowing they didn't use
a cursor. I was once on
> a project where the lead developer actually wanted to re-write avoer 20 cu
rsor based stored
> procedures like so. Fortunately, management pulled the plug on the project
, and I was able to move
> on to more meaningful work.
> CREATE #temptable
> (
> id int NOT NULL IDENTITY (1, 1),
> . . .
> )
> . . .
> select @.id = select min(id) from #temptable
> select @.MAXID = select max(id) from #temptable
> WHILE @.id <= @.MAXID
> BEGIN
> . . .
> select @.id = @.id + 1
> END
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n message
> news:%23ARjZ63jFHA.1504@.TK2MSFTNGP10.phx.gbl...
>|||Yes, I agree on all points. The cursor is just SQL Server's standardized
implementation of looping through a temporary resultset. The only time I use
cursors is for excuting a procdure against a small number of rows, and the
cursor at least makes things more maintainable. By getting familiar with the
various cursor options (like FAST_FORWORD argument) and using common sense,
a developer can use cursors without it becomming a bottleneck.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:uv2k3lRkFHA.3148@.TK2MSFTNGP09.phx.gbl...
> Yes, I have used that technique in version 4.2 (or was it 1.1?), before
> server side cursors was introduced. I think the term cursors is
> misinterpreted/misused, hence the example you mention ("re-do these
> cursors to another procedural technique"). I'm glad you didn't have to do
> that conversion... Personally, I prefer a cursor to the looping of temp
> table approach, I find cursor code more readable. ... In cases like maint
> scripts, for instance.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "JT" <someone@.microsoft.com> wrote in message
> news:uLNefYRkFHA.1204@.TK2MSFTNGP12.phx.gbl...
>