Monday, March 12, 2012
Fastest Way To Make Test Copy of Database
of the production database to their workstations to use for test purposes.
I want to break this down into two separate questions:
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
Assuming the log file is backed up using the native Windows SQL backup
utility on the production database, what is the procedure to apply those
changes to the database on another machine?
2) How can this whole process be automated, so that the programmer could
just run a script and expect that 10 minutes later his database is up to the
current level
Are there applications that would help to automate this whole process?
Will
Internet: westes AT earthbroadcast.com
If the database is small you can write custom script to drop the developer
database and recreate it thru script given to developer.
step 1: Share the network location of backup on both machines
step 2: create linked server on the developer machine
step 3: write custom script on developer machine that go thru cursor like this
a) restore database with norecovery
b) declare c1 INSENSITIVE cursor for
select bmf.physical_device_name file_name
from sql2.msdb.dbo.backupset bs
inner join sql2.msdb.dbo.backupmediafamily bmf
on bmf.media_set_id = bs.media_set_id
where upper(bs.database_name) = upper(@.orig_db_name)
and backup_start_date > (getdate()-2)
and type ='L'
order by bs.backup_start_date
FOR READ ONLY
c) go thru cursor and apply all the Tlogs
EXEC ('RESTORE LOG ' + @.restore_db_name + ' from DISK =' + '''' + @.id +
'''' + ' with standby=' + '''' + 'c:\mssql\data\MSSQL\BACKUP\UNDO_' +
@.restore_db_name + '.DAT' + '''')
At the end restore database with recovery and you will have a DB as of last
tlog backup.
I do what you asked in question 2 but DB is open only as read only and
gets sync from production by custom scripts listed above.
If you have Enterprise edition you do not need to write the custom script as
it is in built in maintenance wizard
" wrote:
> Some of our developers want to automate some system for bringing over a copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>
|||Will
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
A. Detach\Attach database or more secure BACKUP /RESTORE Database
Also take a look at this article
http://www.sql-server-performance.co...g_shipping.asp
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:ex%232INmkFHA.576@.TK2MSFTNGP15.phx.gbl...
> Some of our developers want to automate some system for bringing over a
> copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log
> files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to
> the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>
Fastest Way To Make Test Copy of Database
of the production database to their workstations to use for test purposes.
I want to break this down into two separate questions:
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
Assuming the log file is backed up using the native Windows SQL backup
utility on the production database, what is the procedure to apply those
changes to the database on another machine?
2) How can this whole process be automated, so that the programmer could
just run a script and expect that 10 minutes later his database is up to the
current level
Are there applications that would help to automate this whole process?
--
Will
Internet: westes AT earthbroadcast.comIf the database is small you can write custom script to drop the developer
database and recreate it thru script given to developer.
step 1: Share the network location of backup on both machines
step 2: create linked server on the developer machine
step 3: write custom script on developer machine that go thru cursor like this
a) restore database with norecovery
b) declare c1 INSENSITIVE cursor for
select bmf.physical_device_name file_name
from sql2.msdb.dbo.backupset bs
inner join sql2.msdb.dbo.backupmediafamily bmf
on bmf.media_set_id = bs.media_set_id
where upper(bs.database_name) = upper(@.orig_db_name)
and backup_start_date > (getdate()-2)
and type ='L'
order by bs.backup_start_date
FOR READ ONLY
c) go thru cursor and apply all the Tlogs
EXEC ('RESTORE LOG ' + @.restore_db_name + ' from DISK =' + '''' + @.id +
'''' + ' with standby=' + '''' + 'c:\mssql\data\MSSQL\BACKUP\UNDO_' +
@.restore_db_name + '.DAT' + '''')
At the end restore database with recovery and you will have a DB as of last
tlog backup.
I do what you asked in question 2 but DB is open only as read only and
gets sync from production by custom scripts listed above.
If you have Enterprise edition you do not need to write the custom script as
it is in built in maintenance wizard
" wrote:
> Some of our developers want to automate some system for bringing over a copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>|||Will
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
A. Detach\Attach database or more secure BACKUP /RESTORE Database
Also take a look at this article
http://www.sql-server-performance.com/sql_server_log_shipping.asp
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:ex%232INmkFHA.576@.TK2MSFTNGP15.phx.gbl...
> Some of our developers want to automate some system for bringing over a
> copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log
> files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to
> the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>
Fastest Way To Make Test Copy of Database
of the production database to their workstations to use for test purposes.
I want to break this down into two separate questions:
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
Assuming the log file is backed up using the native Windows SQL backup
utility on the production database, what is the procedure to apply those
changes to the database on another machine?
2) How can this whole process be automated, so that the programmer could
just run a script and expect that 10 minutes later his database is up to the
current level
Are there applications that would help to automate this whole process?
Will
Internet: westes AT earthbroadcast.comIf the database is small you can write custom script to drop the developer
database and recreate it thru script given to developer.
step 1: Share the network location of backup on both machines
step 2: create linked server on the developer machine
step 3: write custom script on developer machine that go thru cursor like th
is
a) restore database with norecovery
b) declare c1 INSENSITIVE cursor for
select bmf.physical_device_name file_name
from sql2.msdb.dbo.backupset bs
inner join sql2.msdb.dbo.backupmediafamily bmf
on bmf.media_set_id = bs.media_set_id
where upper(bs.database_name) = upper(@.orig_db_name)
and backup_start_date > (getdate()-2)
and type ='L'
order by bs.backup_start_date
FOR READ ONLY
c) go thru cursor and apply all the Tlogs
EXEC ('RESTORE LOG ' + @.restore_db_name + ' from DISK =' + '''' + @.id +
'''' + ' with standby=' + '''' + 'c:\mssql\data\MSSQL\BACKUP\UNDO_' +
@.restore_db_name + '.DAT' + '''')
At the end restore database with recovery and you will have a DB as of last
tlog backup.
I do what you asked in question 2 but DB is open only as read only and
gets sync from production by custom scripts listed above.
If you have Enterprise edition you do not need to write the custom script as
it is in built in maintenance wizard
" wrote:
> Some of our developers want to automate some system for bringing over a co
py
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log file
s
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to t
he
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>|||Will
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
A. Detach\Attach database or more secure BACKUP /RESTORE Database
Also take a look at this article
http://www.sql-server-performance.c...og_shipping.asp
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:ex%232INmkFHA.576@.TK2MSFTNGP15.phx.gbl...
> Some of our developers want to automate some system for bringing over a
> copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log
> files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to
> the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>
Fastest Way To Make Test Copy of Database
of the production database to their workstations to use for test purposes.
I want to break this down into two separate questions:
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
Assuming the log file is backed up using the native Windows SQL backup
utility on the production database, what is the procedure to apply those
changes to the database on another machine?
2) How can this whole process be automated, so that the programmer could
just run a script and expect that 10 minutes later his database is up to the
current level
Are there applications that would help to automate this whole process?
Will
Internet: westes AT earthbroadcast.comIf the database is small you can write custom script to drop the developer
database and recreate it thru script given to developer.
step 1: Share the network location of backup on both machines
step 2: create linked server on the developer machine
step 3: write custom script on developer machine that go thru cursor like th
is
a) restore database with norecovery
b) declare c1 INSENSITIVE cursor for
select bmf.physical_device_name file_name
from sql2.msdb.dbo.backupset bs
inner join sql2.msdb.dbo.backupmediafamily bmf
on bmf.media_set_id = bs.media_set_id
where upper(bs.database_name) = upper(@.orig_db_name)
and backup_start_date > (getdate()-2)
and type ='L'
order by bs.backup_start_date
FOR READ ONLY
c) go thru cursor and apply all the Tlogs
EXEC ('RESTORE LOG ' + @.restore_db_name + ' from DISK =' + '''' + @.id +
'''' + ' with standby=' + '''' + 'c:\mssql\data\MSSQL\BACKUP\UNDO_' +
@.restore_db_name + '.DAT' + '''')
At the end restore database with recovery and you will have a DB as of last
tlog backup.
I do what you asked in question 2 but DB is open only as read only and
gets sync from production by custom scripts listed above.
If you have Enterprise edition you do not need to write the custom script as
it is in built in maintenance wizard
" wrote:
> Some of our developers want to automate some system for bringing over a co
py
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log file
s
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to t
he
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>|||Will
1) What is the most efficient way to bring the current database state over
to test machines? What I would like to find is a way to apply just the
change logs to the database currently on the developer's machine. There
just aren't that many changes being made to the database, and the log files
are small.
A. Detach\Attach database or more secure BACKUP /RESTORE Database
Also take a look at this article
http://www.sql-server-performance.c...og_shipping.asp
"Will" <DELETE_westes@.earthbroadcast.com> wrote in message
news:ex%232INmkFHA.576@.TK2MSFTNGP15.phx.gbl...
> Some of our developers want to automate some system for bringing over a
> copy
> of the production database to their workstations to use for test purposes.
> I want to break this down into two separate questions:
> 1) What is the most efficient way to bring the current database state over
> to test machines? What I would like to find is a way to apply just the
> change logs to the database currently on the developer's machine. There
> just aren't that many changes being made to the database, and the log
> files
> are small.
> Assuming the log file is backed up using the native Windows SQL backup
> utility on the production database, what is the procedure to apply those
> changes to the database on another machine?
> 2) How can this whole process be automated, so that the programmer could
> just run a script and expect that 10 minutes later his database is up to
> the
> current level
> Are there applications that would help to automate this whole process?
> --
> Will
> Internet: westes AT earthbroadcast.com
>
>
Fastest way to copy tables and their indexes between servers?
The DTS Task Copy Server Objects is PAINFULLY slow.
The Copy Table Wizard is fast but generates an unmanagable DTS and does not bring over the indexes.
Any tips or tricks to copy tables, data and indexes and a reasonable speed?
Thanks,
Carl
Without fully understanding the specifics but going by what you've done so far, one other option would be to script the database objects to file, run the generated scripts on the second server then use the BCP utility BCP.EXE (bulk copy program) to copy the data over.
See http://msdn2.microsoft.com/en-us/library/aa337544.aspx for more information on how to use the BCP utility.
Regards,
Uwa.
Wednesday, March 7, 2012
fast loading of data to table
How can I load or copy say millions of rows to a table in the database faster?
Thanks,
Mejo GeorgeGive a look to BCP, BULK INSERT or Integration Services (SSIS).|||Expanding on Kent's suggestions, you may wish to remove or disable indexing for the duration of the import, and the rebuild the indexes -if usage permits.|||Thanks Kent & Arnie !!|||Along with these suggestions, you could look at changing your recovery model to the bulk-logged model for the duration of your loading.|||Tks
Sunday, February 26, 2012
Fast copy of data from one table to another
the same instance. The target table has an identity column(PK). What is the
fastest way to do this? The instance has to remain up for the web site, and
yes, the target table is read by the web site. I was thinking a bcp out/in.
Thanks,
MichaelUse SET IDENTITY_INSERT ON/OFF to keep the identity column. There's
also a switch in the bcp utility to keep identities (-E)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_set-set_7zas.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp_bcp_61et.asp
Snake wrote:
> I have to copy the contents of a table (6million rows) into another table on
> the same instance. The target table has an identity column(PK). What is the
> fastest way to do this? The instance has to remain up for the web site, and
> yes, the target table is read by the web site. I was thinking a bcp out/in.
> Thanks,
> Michael
Fast copy of data from one table to another
the same instance. The target table has an identity column(PK). What is the
fastest way to do this? The instance has to remain up for the web site, and
yes, the target table is read by the web site. I was thinking a bcp out/in.
Thanks,
Michael
Use SET IDENTITY_INSERT ON/OFF to keep the identity column. There's
also a switch in the bcp utility to keep identities (-E)
http://msdn.microsoft.com/library/de...t-set_7zas.asp
http://msdn.microsoft.com/library/de...p_bcp_61et.asp
Snake wrote:
> I have to copy the contents of a table (6million rows) into another table on
> the same instance. The target table has an identity column(PK). What is the
> fastest way to do this? The instance has to remain up for the web site, and
> yes, the target table is read by the web site. I was thinking a bcp out/in.
> Thanks,
> Michael
Fast copy of data from one table to another
the same instance. The target table has an identity column(PK). What is th
e
fastest way to do this? The instance has to remain up for the web site, and
yes, the target table is read by the web site. I was thinking a bcp out/in.
Thanks,
MichaelUse SET IDENTITY_INSERT ON/OFF to keep the identity column. There's
also a switch in the bcp utility to keep identities (-E)
http://msdn.microsoft.com/library/d... />
t_7zas.asp
http://msdn.microsoft.com/library/d...
1et.asp
Snake wrote:
> I have to copy the contents of a table (6million rows) into another table
on
> the same instance. The target table has an identity column(PK). What is
the
> fastest way to do this? The instance has to remain up for the web site, a
nd
> yes, the target table is read by the web site. I was thinking a bcp out/in
.
> Thanks,
> Michael
Fast copy big table content
need advice on the following task:
copy the content of a big table from DB_A to DB_B in the same server
the size of table:
~ 7 million rows, ~ 9G in size, 1 clustered pk index, 13 nonclustered
index
current practice:
use DTS to copy the data, takes over 20 hours as
-- first had to delete existing data of the table in DB_B
-- then copy
-- all these happen while all indexes are in place.
I am trying to check what is the best or most efficient way to copy
this kind of data and what would
be the expected time for such load.
my machine: SQL 2000 Enterprise, 8-way P4, 12G RAM on a EMC Clarrion
600 SAN.Most efficient way is:
drop table on DB_B (remember that this invalidates inceremenal backups.
Allow bulk inserts, set recovery to simple or bulk insert on DB_B
use DB_B
then do a
select * FROM DB_A.table_source WITH(NOLOCK) INTO table_dest
Then
CREATE INDEXS
ALTER TABLE ADD PRIMARY KEY
There is no faster way;)
DM Unseen|||"New MSSQL DBA" <boscong88@.gmail.com> wrote in message
news:1119515833.641071.147380@.f14g2000cwb.googlegr oups.com...
> Hi all,
> need advice on the following task:
> copy the content of a big table from DB_A to DB_B in the same server
> the size of table:
> ~ 7 million rows, ~ 9G in size, 1 clustered pk index, 13 nonclustered
> index
> current practice:
> use DTS to copy the data, takes over 20 hours as
> -- first had to delete existing data of the table in DB_B
> -- then copy
> -- all these happen while all indexes are in place.
Dropthe indices and use bulk insert or BCP and then rebuild your indices.
I routinely load a table even bigger than that in under 6 hours this way.
(and I really haven't spent much time optimizing the process since we moved
to the new hardware, so I might be able to improve that further.)
> I am trying to check what is the best or most efficient way to copy
> this kind of data and what would
> be the expected time for such load.
> my machine: SQL 2000 Enterprise, 8-way P4, 12G RAM on a EMC Clarrion
> 600 SAN.
Friday, February 24, 2012
Failure to install - XOLEHLP.dll not found
then copy it to the system 32 folder.
You can download the file from these web sites though:
http://www.dll-downloads.com/searchresults.asp?file=XOLEHLP&filetype=dll
http://www.dll-downloads.ca/searchresults.asp?file=XOLEHLP&filetype=dll
http://www.afreedll.com/dll/info/xolehlp_dll.html
http://www.afreedll.com/dll/info/xolehlp_dll-1.html
Failure to install - XOLEHLP.dll not found
then copy it to the system 32 folder.
You can download the file from these web sites though:
http://www.dll-downloads.com/searchresults.asp?file=XOLEHLP&filetype=dll
http://www.dll-downloads.ca/searchresults.asp?file=XOLEHLP&filetype=dll
http://www.afreedll.com/dll/info/xolehlp_dll.html
http://www.afreedll.com/dll/info/xolehlp_dll-1.html