Showing posts with label objects. Show all posts
Showing posts with label objects. Show all posts

Tuesday, March 20, 2012

copying server objects

I want to copy a database from one server to another. I'm happy about
how to do this but also want to copy a number of DTS packages, jobs and
alerts that relate to this database. Is there any way that I can copy
them or will I need to create them again on the new server.

Many Thanks

Laurence BreezeYou can copy DTS packages by opening up the current package and choosing
"Package/Save As..." from the menu bar. Be careful to make sure your
database references within the DTS package are still appropriate on the
new server.

Both jobs and alerts can be scripted and that script executed on the new
server - right click the jobs or alerts and choose "All Tasks/Generate
SQL Script...". More than one job or alert can be selected at a time if
you desire.

Good luck,
Tony Sebion

"Laurence Breeze" <i.l.breeze@.open.ac.uk> wrote in message
news:433D4E58.2050802@.open.ac.uk:

> I want to copy a database from one server to another. I'm happy about
> how to do this but also want to copy a number of DTS packages, jobs and
> alerts that relate to this database. Is there any way that I can copy
> them or will I need to create them again on the new server.
> Many Thanks
> Laurence Breeze|||Hi

You may want to read
http://support.microsoft.com/defaul...b;en-us;Q314546

John

"Laurence Breeze" <i.l.breeze@.open.ac.uk> wrote in message
news:433D4E58.2050802@.open.ac.uk...
>I want to copy a database from one server to another. I'm happy about how
>to do this but also want to copy a number of DTS packages, jobs and alerts
>that relate to this database. Is there any way that I can copy them or
>will I need to create them again on the new server.
> Many Thanks
> Laurence Breezesql

Monday, March 19, 2012

Copying encrypted objects ?

Hi,

I would like to copy a function from one sql 2005 database to another, but the function is encrypted so cannot use the script to window commands etc... Is there a way of copying encrypted objects from one sql 2005 db to another? I don't really care to know the contents of the function.

Any help appreciated.

James.

I would recommend that you create a DTS Package to transfer the object. There was a 'Copy SQL Server Object Task' that was made exactly for this purpose.|||I tried this out in DTC and although the procedure seems to run successfully, the function still does not appear in the destination database. I take it from this that you cannot copy encrypted functions using DTC unless there is a certain way of doing it?|||Yes if it is encrypted then the DTS would fail, only way is to decrypt and then recreate on the destination server.|||

I thought this would be the case.

thank you for your help :)

Copying encrypted objects ?

Hi,

I would like to copy a function from one sql 2005 database to another, but the function is encrypted so cannot use the script to window commands etc... Is there a way of copying encrypted objects from one sql 2005 db to another? I don't really care to know the contents of the function.

Any help appreciated.

James.

I would recommend that you create a DTS Package to transfer the object. There was a 'Copy SQL Server Object Task' that was made exactly for this purpose.|||I tried this out in DTC and although the procedure seems to run successfully, the function still does not appear in the destination database. I take it from this that you cannot copy encrypted functions using DTC unless there is a certain way of doing it?|||Yes if it is encrypted then the DTS would fail, only way is to decrypt and then recreate on the destination server.|||

I thought this would be the case.

thank you for your help :)

Sunday, March 11, 2012

Copying database objects and data from Oracle 8 to SQL 2005

Does anyone know how to copying database objects and data from Oracle 8 to SQL 2005 ?You cannot use SSIS to copy "objects" from Oracle to SQL Server. I believe that there is no such tool available for this. However, you can use SSIS to transfer data from tables in Oracle db to SQL Server db. Please refer to SSIS documentation for more info.

Wednesday, March 7, 2012

copying a table and all of its objects

Is there any way, using t-sql, to copy a table, all its indices, contraints,
etc? The contraints and indices would have to have a different name, of
course, if they remain in the same database, as would the table.
What I'm trying to do is replicate a table in every way, except foreign
keys, so that I can restore it if needed. If my customer runs a routine in
his windows app that appends rows to an important table, but realizes that
he shouldn't have (for whatever reason), I want to create a backup before he
runs his routine and provide a means of restoring that backup if he realizes
his error, if something goes wrong in the middle (electrical problems, etc).
So I want to make my exact copy first and then be able to restore it
subsequently.
I know how to do this with some tedious and complicated sp's, but I was
hoping there'd be an easier way.
Thanks for any help.
Bernie YaegerBernie Yaeger (berniey@.cherwellinc.com) writes:
> Is there any way, using t-sql, to copy a table, all its indices,
> contraints, etc? The contraints and indices would have to have a
> different name, of course, if they remain in the same database, as would
> the table.
> What I'm trying to do is replicate a table in every way, except foreign
> keys, so that I can restore it if needed. If my customer runs a routine
> in his windows app that appends rows to an important table, but realizes
> that he shouldn't have (for whatever reason), I want to create a backup
> before he runs his routine and provide a means of restoring that backup
> if he realizes his error, if something goes wrong in the middle
> (electrical problems, etc). So I want to make my exact copy first and
> then be able to restore it subsequently.
> I know how to do this with some tedious and complicated sp's, but I was
> hoping there'd be an easier way.
Rather than answering your question, I think we should look at alternate
ways to handle this situation.
First, with proper transaction handling, electric outages should not be
a problem. If the routine is interrupted, nothing should be committed
until all is over. That is, once you bring the machine up again, SQL
Server till automatically rollback the transaction for you.
Next, assuming that once the routine is completed, someone realizes
that he messed up, and wants to restore, SQL Server offers a solution
for this, and therre is a third-party solution. Both of them requires
that you run with the full or bulk-logged recovery model.
SQL Server offer point-in-time restores. That is, you restore a full
backup, and then apply the transaction log to the point in time just
before the mistaken operation. As you may guess this also wipes out
any other activity that took place simultaneously or after the user
mistake.
The 3rd party solution is to rely on Lumigent Log Explorer
(www.lumigent.com). With Log Explorer you can examine the transaction
log for what happened, and you can also have Log Explorer to generate
SQL statements that revokes the operations that should not have occurred.
Of course, if you expect this to be a very common scenario that you
will need to restore data, then you need to develop something application-
specific. But in such case I would have some flag columns that tells
me whether a inserted row is approved. Updated and deleted rows I would
copy to a shadow table, or just set a status bit for "delete_pending" on.
Such a bit would have to be part of the primary key, to handle updates.
Note that your intented solution of restoring the entire table, has the
same problem as point-in-time resotres: you lose all activity in the
table.
Yet one solution is to put the table on a filegroup on its own. Then you
can restore that filegroup only, but I'm lukewarn for that solution.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp|||Hi Erland,
Tx for your reply.
Lots of what you say is of course quite relevant. I will look into several
of your suggetions.
Bernie
"Erland Sommarskog" <sommar@.algonet.se> wrote in message
news:Xns9466ADEF7E64DYazorman@.127.0.0.1...
> Bernie Yaeger (berniey@.cherwellinc.com) writes:
> > Is there any way, using t-sql, to copy a table, all its indices,
> > contraints, etc? The contraints and indices would have to have a
> > different name, of course, if they remain in the same database, as would
> > the table.
> >
> > What I'm trying to do is replicate a table in every way, except foreign
> > keys, so that I can restore it if needed. If my customer runs a routine
> > in his windows app that appends rows to an important table, but realizes
> > that he shouldn't have (for whatever reason), I want to create a backup
> > before he runs his routine and provide a means of restoring that backup
> > if he realizes his error, if something goes wrong in the middle
> > (electrical problems, etc). So I want to make my exact copy first and
> > then be able to restore it subsequently.
> >
> > I know how to do this with some tedious and complicated sp's, but I was
> > hoping there'd be an easier way.
> Rather than answering your question, I think we should look at alternate
> ways to handle this situation.
> First, with proper transaction handling, electric outages should not be
> a problem. If the routine is interrupted, nothing should be committed
> until all is over. That is, once you bring the machine up again, SQL
> Server till automatically rollback the transaction for you.
> Next, assuming that once the routine is completed, someone realizes
> that he messed up, and wants to restore, SQL Server offers a solution
> for this, and therre is a third-party solution. Both of them requires
> that you run with the full or bulk-logged recovery model.
> SQL Server offer point-in-time restores. That is, you restore a full
> backup, and then apply the transaction log to the point in time just
> before the mistaken operation. As you may guess this also wipes out
> any other activity that took place simultaneously or after the user
> mistake.
> The 3rd party solution is to rely on Lumigent Log Explorer
> (www.lumigent.com). With Log Explorer you can examine the transaction
> log for what happened, and you can also have Log Explorer to generate
> SQL statements that revokes the operations that should not have occurred.
> Of course, if you expect this to be a very common scenario that you
> will need to restore data, then you need to develop something application-
> specific. But in such case I would have some flag columns that tells
> me whether a inserted row is approved. Updated and deleted rows I would
> copy to a shadow table, or just set a status bit for "delete_pending" on.
> Such a bit would have to be part of the primary key, to handle updates.
> Note that your intented solution of restoring the entire table, has the
> same problem as point-in-time resotres: you lose all activity in the
> table.
> Yet one solution is to put the table on a filegroup on its own. Then you
> can restore that filegroup only, but I'm lukewarn for that solution.
> --
> Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

Monday, February 13, 2012

Copy SQL Server Objects Fails for certain views

We have been using the 'Copy SQL Server Objects' with success for some time
to copy an entire database to another server. Recent changes to our database
infrastructure cause DTS to fail:
1) We have a check constraint which uses a user function (which refers to
the table on the check constraint
2) We have a view which refers to another view
DTS fails on both. DTS fails on the check constraint and stops. if I remove
the check constraint it will fail on the view. See errors below.
Any hints how to solve this would be appreciated.
Jonathan Orgel
Errors:
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
'dbo.SRS_NumberRWSubjects'
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
'VMSGRECIPIENTS2'
Redefine the package. Copy objects just uses an alphabetical order. If you
define this to explicitly define which objects are moving, you can specify
the order which will move the dependent objects first.
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
> We have been using the 'Copy SQL Server Objects' with success for some
> time to copy an entire database to another server. Recent changes to our
> database infrastructure cause DTS to fail:
> 1) We have a check constraint which uses a user function (which refers to
> the table on the check constraint
> 2) We have a view which refers to another view
> DTS fails on both. DTS fails on the check constraint and stops. if I
> remove the check constraint it will fail on the view. See errors below.
> Any hints how to solve this would be appreciated.
> Jonathan Orgel
> Errors:
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
> 'dbo.SRS_NumberRWSubjects'
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
> 'VMSGRECIPIENTS2'
>
>
|||> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving,
Easier said than done. Our database is a constantly evolving conglomeration
of hundreds of objects. We don't relish having to constantly evolve the DTS
package as well. That's why we are using the more generic transfer
methodology to transfer the entire database, rather than identifying each
object specifically.
Also, it does not seem that objects are copied in alphabetic order, it seems
to have more to do with creation / last modification date. By making an
innocuous change to the object we are now able to complete the transfer. We
did not rename the object, yet we managed to change its transfer sequence.
Nice going Jonathan! :-)
- Joe Geretz -
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:OJOVDuNDGHA.3876@.tk2msftngp13.phx.gbl...
> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving, you can
> specify the order which will move the dependent objects first.
> --
> Mike
> Mentor
> Solid Quality Learning
> http://www.solidqualitylearning.com
>
> "Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
> news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
>

Copy SQL Server Objects Fails for certain views

We have been using the 'Copy SQL Server Objects' with success for some time
to copy an entire database to another server. Recent changes to our database
infrastructure cause DTS to fail:
1) We have a check constraint which uses a user function (which refers to
the table on the check constraint
2) We have a view which refers to another view
DTS fails on both. DTS fails on the check constraint and stops. if I remove
the check constraint it will fail on the view. See errors below.
Any hints how to solve this would be appreciated.
Jonathan Orgel
Errors:
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
'dbo.SRS_NumberRWSubjects'
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
'VMSGRECIPIENTS2'Redefine the package. Copy objects just uses an alphabetical order. If you
define this to explicitly define which objects are moving, you can specify
the order which will move the dependent objects first.
--
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
> We have been using the 'Copy SQL Server Objects' with success for some
> time to copy an entire database to another server. Recent changes to our
> database infrastructure cause DTS to fail:
> 1) We have a check constraint which uses a user function (which refers to
> the table on the check constraint
> 2) We have a view which refers to another view
> DTS fails on both. DTS fails on the check constraint and stops. if I
> remove the check constraint it will fail on the view. See errors below.
> Any hints how to solve this would be appreciated.
> Jonathan Orgel
> Errors:
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
> 'dbo.SRS_NumberRWSubjects'
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
> 'VMSGRECIPIENTS2'
>
>|||> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving,
Easier said than done. Our database is a constantly evolving conglomeration
of hundreds of objects. We don't relish having to constantly evolve the DTS
package as well. That's why we are using the more generic transfer
methodology to transfer the entire database, rather than identifying each
object specifically.
Also, it does not seem that objects are copied in alphabetic order, it seems
to have more to do with creation / last modification date. By making an
innocuous change to the object we are now able to complete the transfer. We
did not rename the object, yet we managed to change its transfer sequence.
Nice going Jonathan! :-)
- Joe Geretz -
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:OJOVDuNDGHA.3876@.tk2msftngp13.phx.gbl...
> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving, you can
> specify the order which will move the dependent objects first.
> --
> Mike
> Mentor
> Solid Quality Learning
> http://www.solidqualitylearning.com
>
> "Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
> news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
>> We have been using the 'Copy SQL Server Objects' with success for some
>> time to copy an entire database to another server. Recent changes to our
>> database infrastructure cause DTS to fail:
>> 1) We have a check constraint which uses a user function (which refers to
>> the table on the check constraint
>> 2) We have a view which refers to another view
>> DTS fails on both. DTS fails on the check constraint and stops. if I
>> remove the check constraint it will fail on the view. See errors below.
>> Any hints how to solve this would be appreciated.
>> Jonathan Orgel
>> Errors:
>> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
>> 'dbo.SRS_NumberRWSubjects'
>> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name
>> 'VMSGRECIPIENTS2'
>>
>

Copy SQL Server Objects Fails for certain views

We have been using the 'Copy SQL Server Objects' with success for some time
to copy an entire database to another server. Recent changes to our database
infrastructure cause DTS to fail:
1) We have a check constraint which uses a user function (which refers to
the table on the check constraint
2) We have a view which refers to another view
DTS fails on both. DTS fails on the check constraint and stops. if I remove
the check constraint it will fail on the view. See errors below.
Any hints how to solve this would be appreciated.
Jonathan Orgel
Errors:
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object n
ame
'dbo.SRS_NumberRWSubjects'
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object n
ame
'VMSGRECIPIENTS2'Redefine the package. Copy objects just uses an alphabetical order. If you
define this to explicitly define which objects are moving, you can specify
the order which will move the dependent objects first.
Mike
Mentor
Solid Quality Learning
http://www.solidqualitylearning.com
"Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
> We have been using the 'Copy SQL Server Objects' with success for some
> time to copy an entire database to another server. Recent changes to our
> database infrastructure cause DTS to fail:
> 1) We have a check constraint which uses a user function (which refers to
> the table on the check constraint
> 2) We have a view which refers to another view
> DTS fails on both. DTS fails on the check constraint and stops. if I
> remove the check constraint it will fail on the view. See errors below.
> Any hints how to solve this would be appreciated.
> Jonathan Orgel
> Errors:
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object
name
> 'dbo.SRS_NumberRWSubjects'
> [Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object
name
> 'VMSGRECIPIENTS2'
>
>|||> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving,
Easier said than done. Our database is a constantly evolving conglomeration
of hundreds of objects. We don't relish having to constantly evolve the DTS
package as well. That's why we are using the more generic transfer
methodology to transfer the entire database, rather than identifying each
object specifically.
Also, it does not seem that objects are copied in alphabetic order, it seems
to have more to do with creation / last modification date. By making an
innocuous change to the object we are now able to complete the transfer. We
did not rename the object, yet we managed to change its transfer sequence.
Nice going Jonathan! :-)
- Joe Geretz -
"Michael Hotek" <mike@.solidqualitylearning.com> wrote in message
news:OJOVDuNDGHA.3876@.tk2msftngp13.phx.gbl...
> Redefine the package. Copy objects just uses an alphabetical order. If
> you define this to explicitly define which objects are moving, you can
> specify the order which will move the dependent objects first.
> --
> Mike
> Mentor
> Solid Quality Learning
> http://www.solidqualitylearning.com
>
> "Jonathan Orgel" <Jonathan@.srssoft.com> wrote in message
> news:ee1MIoJDGHA.3920@.tk2msftngp13.phx.gbl...
>