2012年3月11日星期日
Disaster Recovery rehearsal
I am performing a disaster recovery reharsal for SQL
Server with various test cases on a Test Server. I want to
corrupt the Master Database( without deleting the .ldf)
Manually and then try to recover. Which is the best way to
do this? . also Any resources on Disaster Recovery
reharsals on SQL Servers are appreciated.
Regards
ChipHi
check out following articles about disaster recovery
http://www.sqljunkies.com/HowTo/F30B1E5F-F50F-40A8-96F2-476CEAD46C79.scuk
http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;307775
Regards,
MD
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> Hi,
> I am performing a disaster recovery reharsal for SQL
> Server with various test cases on a Test Server. I want to
> corrupt the Master Database( without deleting the .ldf)
> Manually and then try to recover. Which is the best way to
> do this? . also Any resources on Disaster Recovery
> reharsals on SQL Servers are appreciated.
> Regards
> Chip|||Do you want it to go suspect or just cause a corruption in the master
database?
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> Hi,
> I am performing a disaster recovery reharsal for SQL
> Server with various test cases on a Test Server. I want to
> corrupt the Master Database( without deleting the .ldf)
> Manually and then try to recover. Which is the best way to
> do this? . also Any resources on Disaster Recovery
> reharsals on SQL Servers are appreciated.
> Regards
> Chip|||hi Tibor,
Thanks for the response. what should i do to go it to
suspect(without deleting .ldf) and how to cause a
corruption. Please suggest both ways so that I can have
two test cases in hand. :-)
Sincere Regards
Chip.
>--Original Message--
>Do you want it to go suspect or just cause a corruption
in the master
>database?
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Chip" <anonymous@.discussions.microsoft.com> wrote in
message
>news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
>> Hi,
>> I am performing a disaster recovery reharsal for SQL
>> Server with various test cases on a Test Server. I want
to
>> corrupt the Master Database( without deleting the .ldf)
>> Manually and then try to recover. Which is the best way
to
>> do this? . also Any resources on Disaster Recovery
>> reharsals on SQL Servers are appreciated.
>> Regards
>> Chip
>
>.
>|||Chip,
To make it corrupt, you can create a table and for the table hack some value
in the sysindexes table (IAM column, for instance). You need to figure out
how to do modifications against the systems tables as I don't want to put
that information in a public place.
As for suspect, read the source code for sp_resetstatus and reverse what it
does. It should work on the master database...
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
> hi Tibor,
> Thanks for the response. what should i do to go it to
> suspect(without deleting .ldf) and how to cause a
> corruption. Please suggest both ways so that I can have
> two test cases in hand. :-)
> Sincere Regards
> Chip.
> >--Original Message--
> >Do you want it to go suspect or just cause a corruption
> in the master
> >database?
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at:
> >http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Chip" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> >> Hi,
> >>
> >> I am performing a disaster recovery reharsal for SQL
> >> Server with various test cases on a Test Server. I want
> to
> >> corrupt the Master Database( without deleting the .ldf)
> >> Manually and then try to recover. Which is the best way
> to
> >> do this? . also Any resources on Disaster Recovery
> >> reharsals on SQL Servers are appreciated.
> >>
> >> Regards
> >>
> >> Chip
> >
> >
> >.
> >|||Poor me.
Not a expert dba to hack and crack :-(. If it is possible
to mail the procedure, I will be greatful. I need to
perform this at any cost and send the details to my boss
with step-by-step procedure :-(. Any resources pointing to
achieve this are highly appreciated.
Chip
chipsin007@.NOSPAM.yahoo.com
>--Original Message--
>Chip,
>To make it corrupt, you can create a table and for the
table hack some value
>in the sysindexes table (IAM column, for instance). You
need to figure out
>how to do modifications against the systems tables as I
don't want to put
>that information in a public place.
>As for suspect, read the source code for sp_resetstatus
and reverse what it
>does. It should work on the master database...
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Chip" <anonymous@.discussions.microsoft.com> wrote in
message
>news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
>> hi Tibor,
>> Thanks for the response. what should i do to go it to
>> suspect(without deleting .ldf) and how to cause a
>> corruption. Please suggest both ways so that I can have
>> two test cases in hand. :-)
>> Sincere Regards
>> Chip.
>> >--Original Message--
>> >Do you want it to go suspect or just cause a corruption
>> in the master
>> >database?
>> >
>> >--
>> >Tibor Karaszi, SQL Server MVP
>> >Archive at:
>> >http://groups.google.com/groups?
>> oi=djq&as_ugroup=microsoft.public.sqlserver
>> >
>> >
>> >"Chip" <anonymous@.discussions.microsoft.com> wrote in
>> message
>> >news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
>> >> Hi,
>> >>
>> >> I am performing a disaster recovery reharsal for SQL
>> >> Server with various test cases on a Test Server. I
want
>> to
>> >> corrupt the Master Database( without deleting
the .ldf)
>> >> Manually and then try to recover. Which is the best
way
>> to
>> >> do this? . also Any resources on Disaster Recovery
>> >> reharsals on SQL Servers are appreciated.
>> >>
>> >> Regards
>> >>
>> >> Chip
>> >
>> >
>> >.
>> >
>
>.
>|||You won't, to my knowledge, find any such resources. And I don't have any
ready-made scripts as I always do them as I go along. On top for the first
one is sp_configure and the "allow updates" option. As for the second one,
you need to read the source code of sp_resetstatus and make appropriate
changes (the suspect status is in the status column if
master..sysdatabases). If this makes no sense to you, you really need to
bring someone in to do these things... :-)
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e9d401c3f15c$1898d3e0$a301280a@.phx.gbl...
> Poor me.
> Not a expert dba to hack and crack :-(. If it is possible
> to mail the procedure, I will be greatful. I need to
> perform this at any cost and send the details to my boss
> with step-by-step procedure :-(. Any resources pointing to
> achieve this are highly appreciated.
> Chip
> chipsin007@.NOSPAM.yahoo.com
> >--Original Message--
> >Chip,
> >
> >To make it corrupt, you can create a table and for the
> table hack some value
> >in the sysindexes table (IAM column, for instance). You
> need to figure out
> >how to do modifications against the systems tables as I
> don't want to put
> >that information in a public place.
> >As for suspect, read the source code for sp_resetstatus
> and reverse what it
> >does. It should work on the master database...
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at:
> >http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Chip" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
> >> hi Tibor,
> >>
> >> Thanks for the response. what should i do to go it to
> >> suspect(without deleting .ldf) and how to cause a
> >> corruption. Please suggest both ways so that I can have
> >> two test cases in hand. :-)
> >>
> >> Sincere Regards
> >>
> >> Chip.
> >> >--Original Message--
> >> >Do you want it to go suspect or just cause a corruption
> >> in the master
> >> >database?
> >> >
> >> >--
> >> >Tibor Karaszi, SQL Server MVP
> >> >Archive at:
> >> >http://groups.google.com/groups?
> >> oi=djq&as_ugroup=microsoft.public.sqlserver
> >> >
> >> >
> >> >"Chip" <anonymous@.discussions.microsoft.com> wrote in
> >> message
> >> >news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> >> >> Hi,
> >> >>
> >> >> I am performing a disaster recovery reharsal for SQL
> >> >> Server with various test cases on a Test Server. I
> want
> >> to
> >> >> corrupt the Master Database( without deleting
> the .ldf)
> >> >> Manually and then try to recover. Which is the best
> way
> >> to
> >> >> do this? . also Any resources on Disaster Recovery
> >> >> reharsals on SQL Servers are appreciated.
> >> >>
> >> >> Regards
> >> >>
> >> >> Chip
> >> >
> >> >
> >> >.
> >> >
> >
> >
> >.
> >|||You can always change where SQL looks for the master.mdf file. That will
put you in a DR situation when you restart it. SQL will attempt to come
online and will not be able to start. It is also fixable by changing the
regkey back. I'd practice on a lab server until you are comfortable. USE
AT YOUR OWN RISK.
Christian Smith
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
> hi Tibor,
> Thanks for the response. what should i do to go it to
> suspect(without deleting .ldf) and how to cause a
> corruption. Please suggest both ways so that I can have
> two test cases in hand. :-)
> Sincere Regards
> Chip.
> >--Original Message--
> >Do you want it to go suspect or just cause a corruption
> in the master
> >database?
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at:
> >http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Chip" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> >> Hi,
> >>
> >> I am performing a disaster recovery reharsal for SQL
> >> Server with various test cases on a Test Server. I want
> to
> >> corrupt the Master Database( without deleting the .ldf)
> >> Manually and then try to recover. Which is the best way
> to
> >> do this? . also Any resources on Disaster Recovery
> >> reharsals on SQL Servers are appreciated.
> >>
> >> Regards
> >>
> >> Chip
> >
> >
> >.
> >
Disaster Recovery rehearsal
I am performing a disaster recovery reharsal for SQL
Server with various test cases on a Test Server. I want to
corrupt the Master Database( without deleting the .ldf)
Manually and then try to recover. Which is the best way to
do this? . also Any resources on Disaster Recovery
reharsals on SQL Servers are appreciated.
Regards
ChipHi
check out following articles about disaster recovery
http://www.sqljunkies.com/HowTo/F30...6CEAD46C79.scuk
http://support.microsoft.com/defaul...%5BLN%5D;307775
Regards,
MD
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> Hi,
> I am performing a disaster recovery reharsal for SQL
> Server with various test cases on a Test Server. I want to
> corrupt the Master Database( without deleting the .ldf)
> Manually and then try to recover. Which is the best way to
> do this? . also Any resources on Disaster Recovery
> reharsals on SQL Servers are appreciated.
> Regards
> Chip|||Do you want it to go suspect or just cause a corruption in the master
database?
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
> Hi,
> I am performing a disaster recovery reharsal for SQL
> Server with various test cases on a Test Server. I want to
> corrupt the Master Database( without deleting the .ldf)
> Manually and then try to recover. Which is the best way to
> do this? . also Any resources on Disaster Recovery
> reharsals on SQL Servers are appreciated.
> Regards
> Chip|||hi Tibor,
Thanks for the response. what should i do to go it to
suspect(without deleting .ldf) and how to cause a
corruption. Please suggest both ways so that I can have
two test cases in hand. :-)
Sincere Regards
Chip.
>--Original Message--
>Do you want it to go suspect or just cause a corruption
in the master
>database?
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Chip" <anonymous@.discussions.microsoft.com> wrote in
message
>news:f22a01c3f111$bfee2820$a501280a@.phx.gbl...
to
to
>
>.
>|||Chip,
To make it corrupt, you can create a table and for the table hack some value
in the sysindexes table (IAM column, for instance). You need to figure out
how to do modifications against the systems tables as I don't want to put
that information in a public place.
As for suspect, read the source code for sp_resetstatus and reverse what it
does. It should work on the master database...
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
> hi Tibor,
> Thanks for the response. what should i do to go it to
> suspect(without deleting .ldf) and how to cause a
> corruption. Please suggest both ways so that I can have
> two test cases in hand. :-)
> Sincere Regards
> Chip.
> in the master
> oi=djq&as_ugroup=microsoft.public.sqlserver
> message
> to
> to|||Poor me.
Not a expert dba to hack and crack :-(. If it is possible
to mail the procedure, I will be greatful. I need to
perform this at any cost and send the details to my boss
with step-by-step procedure :-(. Any resources pointing to
achieve this are highly appreciated.
Chip
chipsin007@.NOSPAM.yahoo.com
>--Original Message--
>Chip,
>To make it corrupt, you can create a table and for the
table hack some value
>in the sysindexes table (IAM column, for instance). You
need to figure out
>how to do modifications against the systems tables as I
don't want to put
>that information in a public place.
>As for suspect, read the source code for sp_resetstatus
and reverse what it
>does. It should work on the master database...
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Chip" <anonymous@.discussions.microsoft.com> wrote in
message
>news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
want
the .ldf)
way
>
>.
>|||You won't, to my knowledge, find any such resources. And I don't have any
ready-made scripts as I always do them as I go along. On top for the first
one is sp_configure and the "allow updates" option. As for the second one,
you need to read the source code of sp_resetstatus and make appropriate
changes (the suspect status is in the status column if
master..sysdatabases). If this makes no sense to you, you really need to
bring someone in to do these things... :-)
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e9d401c3f15c$1898d3e0$a301280a@.phx.gbl...
> Poor me.
> Not a expert dba to hack and crack :-(. If it is possible
> to mail the procedure, I will be greatful. I need to
> perform this at any cost and send the details to my boss
> with step-by-step procedure :-(. Any resources pointing to
> achieve this are highly appreciated.
> Chip
> chipsin007@.NOSPAM.yahoo.com
> table hack some value
> need to figure out
> don't want to put
> and reverse what it
> oi=djq&as_ugroup=microsoft.public.sqlserver
> message
> want
> the .ldf)
> way|||You can always change where SQL looks for the master.mdf file. That will
put you in a DR situation when you restart it. SQL will attempt to come
online and will not be able to start. It is also fixable by changing the
regkey back. I'd practice on a lab server until you are comfortable. USE
AT YOUR OWN RISK.
Christian Smith
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:e98501c3f154$c22ad640$a301280a@.phx.gbl...
> hi Tibor,
> Thanks for the response. what should i do to go it to
> suspect(without deleting .ldf) and how to cause a
> corruption. Please suggest both ways so that I can have
> two test cases in hand. :-)
> Sincere Regards
> Chip.
> in the master
> oi=djq&as_ugroup=microsoft.public.sqlserver
> message
> to
> to
2012年2月14日星期二
Disable a task in the current package programmatically?
Hi,
I have a package comprising a number of Data Flow Task steps, to import various tables of data from some Access databases into SQL Server. The name of some of these Access databases will change depending on the date, e.g. last year's data is currently in a database called "2005data.mdb". At year end this will be superseded by "2006data.mdb". The Access databases are within a 3rd party system so I have no control over the file names.
I have a Script Task that checks the current date, and changes the name of an Access database in the connection string to reflect last year's date. But to complicate matters, last year's file might not exist.
So the Script Task checks whether the file name exists. If not, I would like to disable the Task that uses this connection. But how do I reference a task within the package that contains my Script Task, by name, to set the Disabled attribute to true?
I want to do something like CurrentPackage.Tasks("MyDataFlowTask").Disabled = True.
I would also welcome alternative suggestions for how to achieve this.
Many thanks,
Keith.
You cannot reference inwards within a package, so you cannot reference a task. The task must reference the value. The way to do this is to set a variable, and use a property expression that uses that variable value. So you would set a variable, DisableMyTask as true to false in the script then set the property expression on the task's Disable property to that variable, "@.DisableMyTask".
I would however be careful using the Disable property, as the evaluation can be done before you set the variable, so it is too late. A better way to do this is to use an expression on Workflow. Have a constraint leading to your task, and then just add the variable as the test, or rather the negative, so that the constraint is only satisfied when the variable is false. If you have no preceding task to anchor the constraint, just use a sequence container. It will act as an anchor, but do nothing else.
|||Keith,
You can also add an Expression to the constraint from your Script Task that is modifying the connection string. By doing so you can control the flow without having to enable/disable the invalid tasks.
Here's a link on how to add expressions to a precendence constraint: http://msdn2.microsoft.com/en-us/library/ms140040.aspx
Cheers,
Patrik
Hi,
Thanks for the replies. I have tried adding expressions to the precedence constraints, but it is not working correctly.
I originally had 7 Tasks, with a simple precedence constraint of Success between one and the next. I've now added an expression based on a variable, and changed the precedence constraint to "Constraint and Expression", but with this change, steps 5 to 7 no longer execute. They are still validated, but do not Start.
In simplistic terms, the logic I have added is:
After Task 3, if Success and (@.boolPCStatsLastYearExists) then Execute Task 4.
After Task 4, if Success, execute Task 5.
After Task 3, if Success and (@.boolPCStatsLastYearExists = False) then Execute Task 5.
So, whether the boolean value @.boolPCStatsLastYearExists is True or False, Task 5 should be executed. In fact I think it is set to True, because Task 4 executes and creates rows in the database, so it appears Task 4 is executing but Task 5 isn't.
I am developing on my local machine, but cannot run locally (I get an error on the first Data Flow Task), because the SQL database is on a server. So I am deploying to the server and running there.
Can you advise how I should get debugging information to indicate what happens after Task 4 executes, and why Task 5 isn't reached?
Many thanks,
Keith.
|||To debug stuff, use the debugger. Creating a mock DB on your local machine would be a good idea.
Sounds like you have two constraints leading to task 5, but they follow different, mutually exclusive execution paths. So you will never satisfy both constraints in a single execution, correct? If so, have you turned the Or logic option on for those constsraints? It is in the constraint UI, or the LogicalAnd property of the constraint, set it to false.
|||Hi again,
Thanks for that. I had left the default setting (AND) on the constraints. Changing all the constraints where 2 constraints affect one task, led to some progress.
Tasks 1 - 6 now execute fine. But Task 7 never executes.
The constraints on it are:
From Task 5, Success AND @.boolPCFDR1LastYearExists = False
OR
From Task 6, Success.
The first of these conditions should be met, as Task 5 succeeds and writes data, and the boolean is set to False by Task 1 (the Script task), which I can verify in the debugger.
I would greatly appreciate any further suggestions. However, I suspect I will now need to install SQL Server on my already overloaded laptop and recreate the server database locally, so that I can debug. But having looked at the debugger, I am not confident I will have a sufficiently granular view to identify the problem. I'll report back!
Thanks for all your help so far,
Keith.
|||Hi,
OK, I've installed SQL Server locally, copied the database to it, and changed my connection to point to the local database. The same error occurs, and I don't see how to use the debugger to help me resolve it.
I can put a stop in Step 5 Post-Execute, but I can't do any more than verify that the boolean is set to False as expected. What can I do to identify why the processor does not proceed to execute Step 7?
Thanks,
Keith.
|||Solved! (Sort of). I've had a problem with conditions on a precedence constraint. I can set a condition of @.myBooleanVariable, and it executes correctly, only when the variable is set to true. However, I can't find a syntax to say execute when this boolean is False. I tried the obvious NOT @.myBooleanVariable, but this does not pass the syntax check. @.myBooleanVariable = False passes the syntax check, but crucially, does not execute. I've not found another syntax that is accepted.
So reluctantly, I created 2 new variables, set them to the boolean opposite of the 2 existing variables, and used them in my "negative" conditions. So all my conditions on Precedence Constraints now comprise just the name of a boolean variable, prefixed with @..
Thanks,
Keith.
|||Keith,
In the expressions not is represented with ! and equivalency is tested with ==. This should help you remove the additional variable.
Cheers,
Patrik