Hi there:
I write scripts which I must execute in multiple environments (Dev,
Test, UAT, Prod). Dev and Test are located on the same server, so
it's easy to change the db with the USE command. UAT and Prod are on
another server. If I close the script and re-open it, I'm not
prompted for connection information -- it simply defaults to whichever
connection I used last (because I haven't closed SSMS?).
So far, I've use the Object Browser to navigate to an object within
the server.db I want, click New Query, then copy & paste the query
into the new window. This seems pretty cheesy. Is there a more
elegant approach?
Thanks;
Duncan
Duncan A. McRae (google.com@.mcrae.ca) writes:
> I write scripts which I must execute in multiple environments (Dev,
> Test, UAT, Prod). Dev and Test are located on the same server, so
> it's easy to change the db with the USE command. UAT and Prod are on
> another server. If I close the script and re-open it, I'm not
> prompted for connection information -- it simply defaults to whichever
> connection I used last (because I haven't closed SSMS?).
> So far, I've use the Object Browser to navigate to an object within
> the server.db I want, click New Query, then copy & paste the query
> into the new window. This seems pretty cheesy. Is there a more
> elegant approach?
Yes. Right-click in the query window and select Change Connection from
the context menu.
Overall, I prefer Query Analyzer over Mgmt Studio, but being able to
change the connection for a query window is a great feature.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Showing posts with label scripts. Show all posts
Showing posts with label scripts. Show all posts
Tuesday, March 27, 2012
Changing the Recovery model of the database using scripts
Hi,
I am working as a production support for SQL Server.
I dont have access to use Enterpriese manage in this server,
Please help me
To Change the recovery model of master database using scripts.
It will be great if u provide me the scripts
Its very urgent !!!!!
Thanks in advance
Regards,
SaranThe master DB uses the simple recovery model. It can't be changed.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148643864.847674.288290@.j33g2000cwa.googlegroups.com...
Hi,
I am working as a production support for SQL Server.
I dont have access to use Enterpriese manage in this server,
Please help me
To Change the recovery model of master database using scripts.
It will be great if u provide me the scripts
Its very urgent !!!!!
Thanks in advance
Regards,
Saran|||Hi Saran,
ALTER DATABASE Master SET RECOVERY FULL
EXEC sp_helpdb 'master'
Why do you want to change master recovery model?
HTH
Ami
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148643864.847674.288290@.j33g2000cwa.googlegroups.com...
> Hi,
> I am working as a production support for SQL Server.
> I dont have access to use Enterpriese manage in this server,
> Please help me
> To Change the recovery model of master database using scripts.
> It will be great if u provide me the scripts
> Its very urgent !!!!!
> Thanks in advance
> Regards,
> Saran
>|||Hi Ami,
Thanks for your mail and it worked fine!!
We have a standard of having all the databases in Full recovery mode,
I am working for production support here , we need to work on the CMR ,
IMR to solve the tickets .
Thanks,
Saran|||The reason for having full recovery model is when you want to perform transa
ction log backup for
that database. You cannot do log backup for master, event if it is in full r
ecovery model, it still
*behaves* as when it is in simple recovery model.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148652299.920759.64910@.i39g2000cwa.googlegroups.com...
> Hi Ami,
> Thanks for your mail and it worked fine!!
> We have a standard of having all the databases in Full recovery mode,
> I am working for production support here , we need to work on the CMR ,
> IMR to solve the tickets .
> Thanks,
> Saran
>
I am working as a production support for SQL Server.
I dont have access to use Enterpriese manage in this server,
Please help me
To Change the recovery model of master database using scripts.
It will be great if u provide me the scripts
Its very urgent !!!!!
Thanks in advance
Regards,
SaranThe master DB uses the simple recovery model. It can't be changed.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148643864.847674.288290@.j33g2000cwa.googlegroups.com...
Hi,
I am working as a production support for SQL Server.
I dont have access to use Enterpriese manage in this server,
Please help me
To Change the recovery model of master database using scripts.
It will be great if u provide me the scripts
Its very urgent !!!!!
Thanks in advance
Regards,
Saran|||Hi Saran,
ALTER DATABASE Master SET RECOVERY FULL
EXEC sp_helpdb 'master'
Why do you want to change master recovery model?
HTH
Ami
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148643864.847674.288290@.j33g2000cwa.googlegroups.com...
> Hi,
> I am working as a production support for SQL Server.
> I dont have access to use Enterpriese manage in this server,
> Please help me
> To Change the recovery model of master database using scripts.
> It will be great if u provide me the scripts
> Its very urgent !!!!!
> Thanks in advance
> Regards,
> Saran
>|||Hi Ami,
Thanks for your mail and it worked fine!!
We have a standard of having all the databases in Full recovery mode,
I am working for production support here , we need to work on the CMR ,
IMR to solve the tickets .
Thanks,
Saran|||The reason for having full recovery model is when you want to perform transa
ction log backup for
that database. You cannot do log backup for master, event if it is in full r
ecovery model, it still
*behaves* as when it is in simple recovery model.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Saran" <csesaravana@.gmail.com> wrote in message
news:1148652299.920759.64910@.i39g2000cwa.googlegroups.com...
> Hi Ami,
> Thanks for your mail and it worked fine!!
> We have a standard of having all the databases in Full recovery mode,
> I am working for production support here , we need to work on the CMR ,
> IMR to solve the tickets .
> Thanks,
> Saran
>
Friday, February 10, 2012
Changing Data Sources Quick and Dirty
Has anyone stumbled on a quick easy way to change all report DataSources to
one specific shared DataSource? Any cool tricks or scripts or whatnot would
be appreciated. Even just a reply saying that there is no easy way to do it
would be great so I can give up searching for an answer.You could do it manually from the datasources...I am sure you have
figured that part out. You don't actually have to go to the reports to
do this though. I guess there would be a way to change the guid that
represents the datasource on the report in the SQL database. I doubt
that Microsoft will support you if you opt to go that route though. I
would say...practice on a non production machine first. Not sure if
that is much help.|||Timm wrote:
> Has anyone stumbled on a quick easy way to change all report
DataSources to
> one specific shared DataSource? Any cool tricks or scripts or whatnot
would
> be appreciated. Even just a reply saying that there is no easy way to
do it
> would be great so I can give up searching for an answer.
The book "Hitchhiker's guide to reporting service" has a code snippet ,
you need to call soap api SetReportDataSources ,I use it to change
datasouce after I created the reports|||Really? What page is it on?
"ottawa111" wrote:
> Timm wrote:
> > Has anyone stumbled on a quick easy way to change all report
> DataSources to
> > one specific shared DataSource? Any cool tricks or scripts or whatnot
> would
> > be appreciated. Even just a reply saying that there is no easy way to
> do it
> > would be great so I can give up searching for an answer.
> The book "Hitchhiker's guide to reporting service" has a code snippet ,
> you need to call soap api SetReportDataSources ,I use it to change
> datasouce after I created the reports
>|||You can use this code instead the book
Dim reference As New ReportServer.DataSourceReference
reference.Reference = "/MyDS"
Dim dss As New ReportServer.DataSource
dss.Item = CType(reference,
ReportServer.DataSourceDefinitionOrReference)
dss.Name = "MyDS"
Dim dsList() As ReportServer.DataSource = New
ReportServer.DataSource(1){}
dsList(1) = dss
dsList(1).Name = "MyDS"
rs.SetReportDataSources("/Test report1", dsList)
"Timm" wrote:
> Really? What page is it on?
> "ottawa111" wrote:
> >
> > Timm wrote:
> > > Has anyone stumbled on a quick easy way to change all report
> > DataSources to
> > > one specific shared DataSource? Any cool tricks or scripts or whatnot
> > would
> > > be appreciated. Even just a reply saying that there is no easy way to
> > do it
> > > would be great so I can give up searching for an answer.
> >
> > The book "Hitchhiker's guide to reporting service" has a code snippet ,
> > you need to call soap api SetReportDataSources ,I use it to change
> > datasouce after I created the reports
> >
> >
one specific shared DataSource? Any cool tricks or scripts or whatnot would
be appreciated. Even just a reply saying that there is no easy way to do it
would be great so I can give up searching for an answer.You could do it manually from the datasources...I am sure you have
figured that part out. You don't actually have to go to the reports to
do this though. I guess there would be a way to change the guid that
represents the datasource on the report in the SQL database. I doubt
that Microsoft will support you if you opt to go that route though. I
would say...practice on a non production machine first. Not sure if
that is much help.|||Timm wrote:
> Has anyone stumbled on a quick easy way to change all report
DataSources to
> one specific shared DataSource? Any cool tricks or scripts or whatnot
would
> be appreciated. Even just a reply saying that there is no easy way to
do it
> would be great so I can give up searching for an answer.
The book "Hitchhiker's guide to reporting service" has a code snippet ,
you need to call soap api SetReportDataSources ,I use it to change
datasouce after I created the reports|||Really? What page is it on?
"ottawa111" wrote:
> Timm wrote:
> > Has anyone stumbled on a quick easy way to change all report
> DataSources to
> > one specific shared DataSource? Any cool tricks or scripts or whatnot
> would
> > be appreciated. Even just a reply saying that there is no easy way to
> do it
> > would be great so I can give up searching for an answer.
> The book "Hitchhiker's guide to reporting service" has a code snippet ,
> you need to call soap api SetReportDataSources ,I use it to change
> datasouce after I created the reports
>|||You can use this code instead the book
Dim reference As New ReportServer.DataSourceReference
reference.Reference = "/MyDS"
Dim dss As New ReportServer.DataSource
dss.Item = CType(reference,
ReportServer.DataSourceDefinitionOrReference)
dss.Name = "MyDS"
Dim dsList() As ReportServer.DataSource = New
ReportServer.DataSource(1){}
dsList(1) = dss
dsList(1).Name = "MyDS"
rs.SetReportDataSources("/Test report1", dsList)
"Timm" wrote:
> Really? What page is it on?
> "ottawa111" wrote:
> >
> > Timm wrote:
> > > Has anyone stumbled on a quick easy way to change all report
> > DataSources to
> > > one specific shared DataSource? Any cool tricks or scripts or whatnot
> > would
> > > be appreciated. Even just a reply saying that there is no easy way to
> > do it
> > > would be great so I can give up searching for an answer.
> >
> > The book "Hitchhiker's guide to reporting service" has a code snippet ,
> > you need to call soap api SetReportDataSources ,I use it to change
> > datasouce after I created the reports
> >
> >
Subscribe to:
Posts (Atom)