Showing posts with label task. Show all posts
Showing posts with label task. Show all posts

Friday, March 30, 2012

How to schedule Usage Based Optimization on a regular basis?

I want to perform Usage Based Optimization on given partitions automatically (not using the wizard). Is it possible to schedule this task and how?

I don't know of anyway "out of the box" that this can be done. You could write your own program using AMO to facilitate this, but there are a couple of issues that come to mind.

1) You should not need to continuously re-run the usage based optimizations unless the useage patterns are changing significantly. Optimizing a cube for a given usage pattern only needs to be done once. Once the aggregations have been designed they will be used every time the cube is reprocessed (or specifically when the index processing is done)

2) There is an issue with UBO in that it overwrites previously designed aggregations (see this thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=806335&SiteID=1) so your performance could possibly regress, rather than incrementally improve, if you ran it unattended.

|||Thanks a lotsql

How to schedule backup task

I'm new to sql server. I want to schedule a backup task. But everytime I did
it by right clicking the database -- All Tasks -- Backup database, then
ticking the "Schedule", next time I couldn't find where it is. It's always
unticked. I don't know where is my previous scheduled settings. Am I doing
it in the right way?
Thank u very much for your help.OK
In your SQL Server Server tree in Enterprise Manager you have
Management | SQL Server Agent | Jobs
You should find your job schedules in here
Also look in BOL (Books Online)
Subjects
Jobs (Scheduling, creating)
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"JL" <ljmagzine@.hotmail.com> wrote in message
news:eomg9#0TDHA.1712@.TK2MSFTNGP11.phx.gbl...
> I'm new to sql server. I want to schedule a backup task. But everytime I
did
> it by right clicking the database -- All Tasks -- Backup database, then
> ticking the "Schedule", next time I couldn't find where it is. It's always
> unticked. I don't know where is my previous scheduled settings. Am I doing
> it in the right way?
> Thank u very much for your help.
>|||In addition to Allan's comments, make sure the SQL Server Agent service is
running and that it's set to run automatically. This service basically
manages all the automatic jobs inside sql server.
--
Carlos E. Rojas
SQL Server MVP
Co-Author SQL Server 2000 Programming by Example
"JL" <ljmagzine@.hotmail.com> wrote in message
news:eomg9%230TDHA.1712@.TK2MSFTNGP11.phx.gbl...
> I'm new to sql server. I want to schedule a backup task. But everytime I
did
> it by right clicking the database -- All Tasks -- Backup database, then
> ticking the "Schedule", next time I couldn't find where it is. It's always
> unticked. I don't know where is my previous scheduled settings. Am I doing
> it in the right way?
> Thank u very much for your help.
>sql

Wednesday, March 28, 2012

How to Schedule a task in Vista

Hi All,

Is Vista get rid of the task scheduling? We can schedule a task easily through the Scheduled Task under control panel, but I cannot find similar stuff in Vista.

Can anyone tell me if schedule a task is still available in Vista? If yes, where can I do that?

Thakns in advance!

Gordon

Ummm... A suggestion, especially for something that isn't released yet:

Search Microsoft's Web site for this information. Or even Google.

Your answer looks to be in the first link when I searched for "windows vista scheduled task" in Google.

Phil|||Good suggestion and will keep in mind!

how to save result of sql query to .csv file "using command in sql query itself"

Hello there

I m new in sql..i want to know wether above said task is possible in sql?

if yes then what is exact format of sql query command..

Thanks

AVD

YOu can have a look in the BOL for OPENDATASOURCE, there should a sample for an output to a propetary format.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Wednesday, March 21, 2012

How to run backup in EM?

I'm running SQL Server 2000 on Win2k Server. I've right clicked on a
database, selected all task and backup database. How do I run this backup
manually to check it?
Thanks,
BrettBrett,
Did you mean to ask you want to check if the backup file is valid? If so,
try a restore.You can do it via EM (all tasks | restore database) or through
the RESTORE DATABASE command in Query analyzer.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Brett" <myaccount@.cygen.com> wrote in message
news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> I'm running SQL Server 2000 on Win2k Server. I've right clicked on a
> database, selected all task and backup database. How do I run this backup
> manually to check it?
> Thanks,
> Brett
>|||I haven't run the backup yet. There is not file to check.
Thanks,
Brett
"Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> Brett,
> Did you mean to ask you want to check if the backup file is valid? If so,
> try a restore.You can do it via EM (all tasks | restore database) or
through
> the RESTORE DATABASE command in Query analyzer.
> --
> Dinesh.
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Brett" <myaccount@.cygen.com> wrote in message
> news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > I'm running SQL Server 2000 on Win2k Server. I've right clicked on a
> > database, selected all task and backup database. How do I run this
backup
> > manually to check it?
> >
> > Thanks,
> > Brett
> >
> >
>|||Brett,
Ok.So you can backup the database in the way you mentioned in EM.Are you
facing any problems?The equivalent T-SQL command is BACKUP DATABASE.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Brett" <myaccount@.cygen.com> wrote in message
news:%23S$LMUBaDHA.1832@.TK2MSFTNGP09.phx.gbl...
> I haven't run the backup yet. There is not file to check.
> Thanks,
> Brett
> "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> > Brett,
> >
> > Did you mean to ask you want to check if the backup file is valid? If
so,
> > try a restore.You can do it via EM (all tasks | restore database) or
> through
> > the RESTORE DATABASE command in Query analyzer.
> >
> > --
> > Dinesh.
> > SQL Server FAQ at
> > http://www.tkdinesh.com
> >
> > "Brett" <myaccount@.cygen.com> wrote in message
> > news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > I'm running SQL Server 2000 on Win2k Server. I've right clicked on a
> > > database, selected all task and backup database. How do I run this
> backup
> > > manually to check it?
> > >
> > > Thanks,
> > > Brett
> > >
> > >
> >
> >
>|||I'm asking how to backup the database. It is scheduled but I'd like to back
up before the scheduled date.
Brett
"Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:%23QkNLWBaDHA.2520@.TK2MSFTNGP09.phx.gbl...
> Brett,
> Ok.So you can backup the database in the way you mentioned in EM.Are you
> facing any problems?The equivalent T-SQL command is BACKUP DATABASE.
> --
> Dinesh.
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Brett" <myaccount@.cygen.com> wrote in message
> news:%23S$LMUBaDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > I haven't run the backup yet. There is not file to check.
> >
> > Thanks,
> > Brett
> >
> > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> > > Brett,
> > >
> > > Did you mean to ask you want to check if the backup file is valid? If
> so,
> > > try a restore.You can do it via EM (all tasks | restore database) or
> > through
> > > the RESTORE DATABASE command in Query analyzer.
> > >
> > > --
> > > Dinesh.
> > > SQL Server FAQ at
> > > http://www.tkdinesh.com
> > >
> > > "Brett" <myaccount@.cygen.com> wrote in message
> > > news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > > I'm running SQL Server 2000 on Win2k Server. I've right clicked on
a
> > > > database, selected all task and backup database. How do I run this
> > backup
> > > > manually to check it?
> > > >
> > > > Thanks,
> > > > Brett
> > > >
> > > >
> > >
> > >
> >
> >
>|||Brett,
Try this syntax in Query analyzer..
BACKUP DATABASE <databasename>
TO DISK='c:\data\database.BAK'
Since you already have the sql job scheduled, just right click and start the
job to run it manually.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Brett" <myaccount@.cygen.com> wrote in message
news:u2ms6uBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> I'm asking how to backup the database. It is scheduled but I'd like to
back
> up before the scheduled date.
> Brett
> "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> news:%23QkNLWBaDHA.2520@.TK2MSFTNGP09.phx.gbl...
> > Brett,
> >
> > Ok.So you can backup the database in the way you mentioned in EM.Are you
> > facing any problems?The equivalent T-SQL command is BACKUP DATABASE.
> >
> > --
> > Dinesh.
> > SQL Server FAQ at
> > http://www.tkdinesh.com
> >
> > "Brett" <myaccount@.cygen.com> wrote in message
> > news:%23S$LMUBaDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > > I haven't run the backup yet. There is not file to check.
> > >
> > > Thanks,
> > > Brett
> > >
> > > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > > news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> > > > Brett,
> > > >
> > > > Did you mean to ask you want to check if the backup file is valid?
If
> > so,
> > > > try a restore.You can do it via EM (all tasks | restore database) or
> > > through
> > > > the RESTORE DATABASE command in Query analyzer.
> > > >
> > > > --
> > > > Dinesh.
> > > > SQL Server FAQ at
> > > > http://www.tkdinesh.com
> > > >
> > > > "Brett" <myaccount@.cygen.com> wrote in message
> > > > news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > > > I'm running SQL Server 2000 on Win2k Server. I've right clicked
on
> a
> > > > > database, selected all task and backup database. How do I run this
> > > backup
> > > > > manually to check it?
> > > > >
> > > > > Thanks,
> > > > > Brett
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||I see the job listed. When I right click and start job, nothing happens.
Any suggestions?
Brett
"Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:u7%23XK1BaDHA.1640@.TK2MSFTNGP10.phx.gbl...
> Brett,
> Try this syntax in Query analyzer..
> BACKUP DATABASE <databasename>
> TO DISK='c:\data\database.BAK'
> Since you already have the sql job scheduled, just right click and start
the
> job to run it manually.
> --
> Dinesh.
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Brett" <myaccount@.cygen.com> wrote in message
> news:u2ms6uBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > I'm asking how to backup the database. It is scheduled but I'd like to
> back
> > up before the scheduled date.
> >
> > Brett
> > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > news:%23QkNLWBaDHA.2520@.TK2MSFTNGP09.phx.gbl...
> > > Brett,
> > >
> > > Ok.So you can backup the database in the way you mentioned in EM.Are
you
> > > facing any problems?The equivalent T-SQL command is BACKUP DATABASE.
> > >
> > > --
> > > Dinesh.
> > > SQL Server FAQ at
> > > http://www.tkdinesh.com
> > >
> > > "Brett" <myaccount@.cygen.com> wrote in message
> > > news:%23S$LMUBaDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > > > I haven't run the backup yet. There is not file to check.
> > > >
> > > > Thanks,
> > > > Brett
> > > >
> > > > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > > > news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> > > > > Brett,
> > > > >
> > > > > Did you mean to ask you want to check if the backup file is valid?
> If
> > > so,
> > > > > try a restore.You can do it via EM (all tasks | restore database)
or
> > > > through
> > > > > the RESTORE DATABASE command in Query analyzer.
> > > > >
> > > > > --
> > > > > Dinesh.
> > > > > SQL Server FAQ at
> > > > > http://www.tkdinesh.com
> > > > >
> > > > > "Brett" <myaccount@.cygen.com> wrote in message
> > > > > news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > > > > I'm running SQL Server 2000 on Win2k Server. I've right clicked
> on
> > a
> > > > > > database, selected all task and backup database. How do I run
this
> > > > backup
> > > > > > manually to check it?
> > > > > >
> > > > > > Thanks,
> > > > > > Brett
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Brett,
Well, "nothing happens", does not mean anything - success or failure.The job
wont give you a dialog box mentioning the status upon completion.You can
look into the code inside the sql job, see where the backup is being made
and check the filesystem whether that file was created.Right click on the
job | refresh and then check the job history whether it ran
successfully.Also, did you try the syntax that I mentioned?
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Brett" <myaccount@.cygen.com> wrote in message
news:O7RtggCaDHA.656@.tk2msftngp13.phx.gbl...
> I see the job listed. When I right click and start job, nothing happens.
> Any suggestions?
> Brett
> "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> news:u7%23XK1BaDHA.1640@.TK2MSFTNGP10.phx.gbl...
> > Brett,
> >
> > Try this syntax in Query analyzer..
> >
> > BACKUP DATABASE <databasename>
> > TO DISK='c:\data\database.BAK'
> >
> > Since you already have the sql job scheduled, just right click and start
> the
> > job to run it manually.
> >
> > --
> > Dinesh.
> > SQL Server FAQ at
> > http://www.tkdinesh.com
> >
> > "Brett" <myaccount@.cygen.com> wrote in message
> > news:u2ms6uBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > I'm asking how to backup the database. It is scheduled but I'd like
to
> > back
> > > up before the scheduled date.
> > >
> > > Brett
> > > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > > news:%23QkNLWBaDHA.2520@.TK2MSFTNGP09.phx.gbl...
> > > > Brett,
> > > >
> > > > Ok.So you can backup the database in the way you mentioned in EM.Are
> you
> > > > facing any problems?The equivalent T-SQL command is BACKUP DATABASE.
> > > >
> > > > --
> > > > Dinesh.
> > > > SQL Server FAQ at
> > > > http://www.tkdinesh.com
> > > >
> > > > "Brett" <myaccount@.cygen.com> wrote in message
> > > > news:%23S$LMUBaDHA.1832@.TK2MSFTNGP09.phx.gbl...
> > > > > I haven't run the backup yet. There is not file to check.
> > > > >
> > > > > Thanks,
> > > > > Brett
> > > > >
> > > > > "Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
> > > > > news:uImszPBaDHA.2336@.TK2MSFTNGP09.phx.gbl...
> > > > > > Brett,
> > > > > >
> > > > > > Did you mean to ask you want to check if the backup file is
valid?
> > If
> > > > so,
> > > > > > try a restore.You can do it via EM (all tasks | restore
database)
> or
> > > > > through
> > > > > > the RESTORE DATABASE command in Query analyzer.
> > > > > >
> > > > > > --
> > > > > > Dinesh.
> > > > > > SQL Server FAQ at
> > > > > > http://www.tkdinesh.com
> > > > > >
> > > > > > "Brett" <myaccount@.cygen.com> wrote in message
> > > > > > news:OevbiKBaDHA.2072@.TK2MSFTNGP10.phx.gbl...
> > > > > > > I'm running SQL Server 2000 on Win2k Server. I've right
clicked
> > on
> > > a
> > > > > > > database, selected all task and backup database. How do I run
> this
> > > > > backup
> > > > > > > manually to check it?
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Brett
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

How to run an exe in the SSIS scripting task

Hi,

Can anyone help me how to run an exe file in the scripting task.

I was trying the below code but it's giving an error.

Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "c:\Test\ABC.exe", 6, True
set wshshell = nothing

Thanks,

rkn

Here's one way. You may want to check out the MSDN for any security risks, etc.

Dim procID As Integer

procID = Shell("""C:\Program Files\Microsoft Office\OFFICE11\winword.exe"" c:\temp\test.doc")

Larry Pope|||

I would be inclined to choose .NET's Process.Start method as the more language-neutral approach...but it's possible that this is what the VB Shell command calls anyway.

-Doug

|||I believe the Process.Start method has the limitation of not being able

to add cmdline parameters, which was included in the original posters

code.

If I'm wrong about the Process.Start method not being able to use

cmdline parameters, please post some code. I would love to be

able to use that rather than Shell.

Larry|||

I think what you are looking for is something like this:

System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(Setting.PostProcessor,commandLineArgs);

startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;

startInfo.WorkingDirectory = "C:\\Test";

startInfo.UseShellExecute = false;

System.Diagnostics.Process process = new System.Diagnostics.Process();

process.StartInfo = startInfo;

process.Start();

Hossein Riazi

|||

The Start method also has other overloads suited for command line arguments, such as

Process.Start Method (String, String)

Starts a process resource by specifying the name of an application and a set of command-line arguments, and associates the resource with a new Process component.

-Doug

Monday, March 19, 2012

How to run "Execute Package" Task Conditionally in SSIS?

I have a boolean variable in my package. How to run "Execute Package" Task Conditionally using that variable?
For example if the variable is True, I want to run the Task else just skip this task and continue to the next one. The Control flow should continue after this task. How do I achieve this?

How to do the same for "Execute SQL" task?Lets assume this simple scenario:

Task 1 > Execute package (task 2) > Task 3

Lets change this for the desired behavior.
After Task1, have one arrow go to Execute package task, as above AND have another arrow go from Task 1 to Task 3 directly.

Now, right-click on BOTH the arrows and specify expression on each of them. One expression will be @.my_variable = true and another will be @.my_variable = false.

Depending upon value of @.my_variable, one of the paths will be taken.

HTH,
Nitesh|||This doe't help I tried it already. It breaks the flow. The control never reaches to Task3. I want to just skip Task2. In Both case I want to run Task3. When the condition is not met for Task2, the control flow breaks there. According to MS, that is by design. I have no idea to about how to achieve this. Any help will be appreciated.|||Ok, Let's try this. Have the control flow as follows:
Task 1 -> Task 2 -> Task 3
And another path directly from Task 1 -> Task 3
For Task 2, set the expression for "Disable" property based on the variable value you want to use to decide whether Task 2 should be executed or not.

If that variable is true, Task 2 will be disabled, if not it will remain enabled. Let me know if that lets you accomplish your scenario.

Thanks
Ranjeeta|||

See this thread:
http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=63760
K

|||

mci wrote:

This doe't help I tried it already. It breaks the flow. The control never reaches to Task3. I want to just skip Task2. In Both case I want to run Task3. When the condition is not met for Task2, the control flow breaks there. According to MS, that is by design. I have no idea to about how to achieve this. Any help will be appreciated.

Place task1 and task2 in a sequence container. Task3 should execute after the sequence container. You can put an expression on the precedence constraint between task1 and task2 to specify whether task2 should execute or not.

More details here: http://blogs.conchango.com/jamiethomson/archive/2005/07/27/1889.aspx. The bit in the "UPDATE" section at the bottom illustrates exactly what I have described here.

-Jamie

Wednesday, March 7, 2012

How to retrieve Global Variables in an ActiveX Script Task using VBScript in SSIS

I need to retrieve the Global Variables set in my package configuration file within an ActiveX Script Task within an SSIS package. In DTS, I could access the Global Variables to execute a SQLXMLBulkLoad for the following statement:

==========================================

Function Main()

Response.Expires=-1

set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString =
"provider=SQLOLEDB.1;server=ABC123;database=MyDB;Trusted_Connection=Yes;"
objBL.KeepIdentity = False
objBL.CheckConstraints = False

objBL.Execute DTSGlobalVariables("gv_XSDSchemaFile").Value, DTSGlobalVariables("gv_XMLFullPath").Value
Main = DTSTaskExecResult_Success
set objBL=Nothing

End Function
=========================================

I have tried using the Script Task to write this in VB.NET, however the MSXML4.0 is not exposed within the limited object model of the Script Task Designer. I have written a Data Flow Object using the XML Source, however it requires quite a bit of effort to have the Data Flow Component parse the XML (with 10 hierarchical nodes), transform each and provide a SQL Server Destination. This works, however the XML Source Component requires a hardcoded reference to the XSD Schema file and does not allow for a Global Variable to used. (They do provide this functionality for the XML file source though).

My requirement is to allow for the Global Variable to be passed for the Schema file at runtime. The only way I can think of is to recreate what I was doing in DTS where I could simply pull in the XML and XSD Global Variables and execute the SQLXMLBulkLoad in VB Script.

Any ideas on how to write this in VBScript within the ActiveX Script Task in SSIS?...

Michael

No answer on all your questions but stick with using the XML source as this is what SSIS is designed for.

While the XML source does not cater for a variable for the XSD path, it does allow you to set it via expressions. Essentially the same thing.

When the data flow is highlighted, see properties > Expressions. There is a [XMLSource.DataSchemaDefinition] property which you can set if a variable or a value built up from expressions.

Also, stay away from the Active X Script task...