显示标签为“logfile”的博文。显示所有博文
显示标签为“logfile”的博文。显示所有博文

2012年2月18日星期六

bcp - Transaction LogFile Size issue

Hi Experts,
I am having new issue again,
My task is to copy data from one table to another table residing in
different database.
Table happenes to be extreamly large. (Contains around 15 million
rows.)
I tried several ways (SQL query, SSIS packages,etc...)
I found BCP utility suits my requirement. So planned for BCP.
I am trying following ways (Two steps)
1. bcp <MyFirstDB.TableName> out <MyFlatFilePath> -n -T
2.bcp <MySecondDB.TableName> in <MyFlatFilePath> -n -T
(Basically, Copying data from source to flat file and from there to
DestinationTable.)
Here problem is, My transaction Log file (MySecondDB_log.ldf) grows
like hell on second command. It grows upto 8 GB (max. free space That
I have on disk ).
My datatransfer will be incomplete because of no space on HardDisk.
PLease let me know, where I am going wrong,if you have better method,
how can i optimize my data transfer. (My log file grows by 2 MB, not
with %ge)
Thank you in advance,
Sriharsha Karagodu.
Are you changing the second database's recovery to bulk?
On Mar 17, 9:56Xam, sriharsha.karag...@.gmail.com wrote:
> Hi Experts,
> I am having new issue again,
> My task is to copy data from one table to another table residing in
> different database.
> Table happenes to be extreamly large. (Contains around 15 million
> rows.)
> I tried several ways (SQL query, SSIS packages,etc...)
> I found BCP utility suits my requirement. So planned for BCP.
> I am trying following ways (Two steps)
> 1. bcp X<MyFirstDB.TableName> out <MyFlatFilePath> -n -T
> 2.bcp X<MySecondDB.TableName> in <MyFlatFilePath> -n -T
> (Basically, Copying data from source to flat file and from there to
> DestinationTable.)
> Here problem is, My transaction Log file (MySecondDB_log.ldf) grows
> like hell on second command. It grows upto 8 GB (max. free space That
> I have on disk ).
> My datatransfer will be incomplete because of no space on HardDisk.
> PLease let me know, where I am going wrong,if you have better method,
> how can i optimize my data transfer. (My log file grows by 2 MB, not
> with %ge)
> Thank you in advance,
> Sriharsha Karagodu.
|||On Mar 17, 6:59Xpm, Sean <ColdFusion...@.gmail.com> wrote:
> Are you changing the second database's recovery to bulk?
> On Mar 17, 9:56Xam, sriharsha.karag...@.gmail.com wrote:
>
>
>
>
>
>
> - Show quoted text -
Actually I read about Changing the Recovery Property. But Where Do I
Get that option?
When I Do Property of Database--> options-->recovery, This will have
three options like,
TonrnPageDetection,
CheckSum,
None.
So, Not sure where will get option to change the recovery to BULK.
please guide me.
|||You can do it visually, but the syntax goes like this:
ALTER DATABASE [database name]
SET RECOVERY [either: FULL | BULK_LOGGED | SIMPLE]
Also, to see what the current recovery model is run: SP_HELPDB
[database name]
1. Run SP_HELPDB [database name], and note the model used.
2. ALTER DATABASE [database name] SET RECOVERY BULK_LOGGED
3. Run SP_HELPDB [database name] to double check the settings
4. Run bcp import
5. ALTER DATABASE [databasename] SET RECOVERY (output of step 2)
6. SP_HELPDB [database name] to double check
|||Shriharsha,
When BCPing in so much data, it is also good to use the batch size operator
to control the transaction size. Such as:
bcp ... -b 50000
This will break up your bcp into about 300 batches, which will speed it up
and gives you more transaction log control. You could then (if necessary)
run extra BACKUP LOGs during the bcp in.
RLF
"Sean" <ColdFusion244@.gmail.com> wrote in message
news:ba587a67-ef18-452e-88a2-d6132234fc5c@.t54g2000hsg.googlegroups.com...
> You can do it visually, but the syntax goes like this:
> ALTER DATABASE [database name]
> SET RECOVERY [either: FULL | BULK_LOGGED | SIMPLE]
> Also, to see what the current recovery model is run: SP_HELPDB
> [database name]
> 1. Run SP_HELPDB [database name], and note the model used.
> 2. ALTER DATABASE [database name] SET RECOVERY BULK_LOGGED
> 3. Run SP_HELPDB [database name] to double check the settings
> 4. Run bcp import
> 5. ALTER DATABASE [databasename] SET RECOVERY (output of step 2)
> 6. SP_HELPDB [database name] to double check
>
|||Thanks Rusell and Sean,
I have changed the model to "BULK_LOGGED" and used -b attribute in bcp import.
Smaller the batch size, faster is the data transfer
"Russell Fields" wrote:

> Shriharsha,
> When BCPing in so much data, it is also good to use the batch size operator
> to control the transaction size. Such as:
> bcp ... -b 50000
> This will break up your bcp into about 300 batches, which will speed it up
> and gives you more transaction log control. You could then (if necessary)
> run extra BACKUP LOGs during the bcp in.
> RLF
> "Sean" <ColdFusion244@.gmail.com> wrote in message
> news:ba587a67-ef18-452e-88a2-d6132234fc5c@.t54g2000hsg.googlegroups.com...
>
>

bcp - Transaction LogFile Size issue

Hi Experts,
I am having new issue again,
My task is to copy data from one table to another table residing in
different database.
Table happenes to be extreamly large. (Contains around 15 million
rows.)
I tried several ways (SQL query, SSIS packages,etc...)
I found BCP utility suits my requirement. So planned for BCP.
I am trying following ways (Two steps)
1. bcp <MyFirstDB.TableName> out <MyFlatFilePath> -n -T
2.bcp <MySecondDB.TableName> in <MyFlatFilePath> -n -T
(Basically, Copying data from source to flat file and from there to
DestinationTable.)
Here problem is, My transaction Log file (MySecondDB_log.ldf) grows
like hell on second command. It grows upto 8 GB (max. free space That
I have on disk :) ).
My datatransfer will be incomplete because of no space on HardDisk.
PLease let me know, where I am going wrong,if you have better method,
how can i optimize my data transfer. (My log file grows by 2 MB, not
with %ge)
Thank you in advance,
Sriharsha Karagodu.Are you changing the second database's recovery to bulk?
On Mar 17, 9:56=A0am, sriharsha.karag...@.gmail.com wrote:
> Hi Experts,
> I am having new issue again,
> My task is to copy data from one table to another table residing in
> different database.
> Table happenes to be extreamly large. (Contains around 15 million
> rows.)
> I tried several ways (SQL query, SSIS packages,etc...)
> I found BCP utility suits my requirement. So planned for BCP.
> I am trying following ways (Two steps)
> 1. bcp =A0<MyFirstDB.TableName> out <MyFlatFilePath> -n -T
> 2.bcp =A0<MySecondDB.TableName> in <MyFlatFilePath> -n -T
> (Basically, Copying data from source to flat file and from there to
> DestinationTable.)
> Here problem is, My transaction Log file (MySecondDB_log.ldf) grows
> like hell on second command. It grows upto 8 GB (max. free space That
> I have on disk :) ).
> My datatransfer will be incomplete because of no space on HardDisk.
> PLease let me know, where I am going wrong,if you have better method,
> how can i optimize my data transfer. (My log file grows by 2 MB, not
> with %ge)
> Thank you in advance,
> Sriharsha Karagodu.|||On Mar 17, 6:59=A0pm, Sean <ColdFusion...@.gmail.com> wrote:
> Are you changing the second database's recovery to bulk?
> On Mar 17, 9:56=A0am, sriharsha.karag...@.gmail.com wrote:
>
> > Hi Experts,
> > I am having new issue again,
> > My task is to copy data from one table to another table residing in
> > different database.
> > Table happenes to be extreamly large. (Contains around 15 million
> > rows.)
> > I tried several ways (SQL query, SSIS packages,etc...)
> > I found BCP utility suits my requirement. So planned for BCP.
> > I am trying following ways (Two steps)
> > 1. bcp =A0<MyFirstDB.TableName> out <MyFlatFilePath> -n -T
> > 2.bcp =A0<MySecondDB.TableName> in <MyFlatFilePath> -n -T
> > (Basically, Copying data from source to flat file and from there to
> > DestinationTable.)
> > Here problem is, My transaction Log file (MySecondDB_log.ldf) grows
> > like hell on second command. It grows upto 8 GB (max. free space That
> > I have on disk :) ).
> > My datatransfer will be incomplete because of no space on HardDisk.
> > PLease let me know, where I am going wrong,if you have better method,
> > how can i optimize my data transfer. (My log file grows by 2 MB, not
> > with %ge)
> > Thank you in advance,
> > Sriharsha Karagodu.- Hide quoted text -
> - Show quoted text -
Actually I read about Changing the Recovery Property. But Where Do I
Get that option?
When I Do Property of Database--> options-->recovery, This will have
three options like,
TonrnPageDetection,
CheckSum,
None.
So, Not sure where will get option to change the recovery to BULK.
please guide me.|||You can do it visually, but the syntax goes like this:
ALTER DATABASE [database name]
SET RECOVERY [either: FULL | BULK_LOGGED | SIMPLE]
Also, to see what the current recovery model is run: SP_HELPDB
[database name]
1. Run SP_HELPDB [database name], and note the model used.
2. ALTER DATABASE [database name] SET RECOVERY BULK_LOGGED
3. Run SP_HELPDB [database name] to double check the settings
4. Run bcp import
5. ALTER DATABASE [databasename] SET RECOVERY (output of step 2)
6. SP_HELPDB [database name] to double check|||Shriharsha,
When BCPing in so much data, it is also good to use the batch size operator
to control the transaction size. Such as:
bcp ... -b 50000
This will break up your bcp into about 300 batches, which will speed it up
and gives you more transaction log control. You could then (if necessary)
run extra BACKUP LOGs during the bcp in.
RLF
"Sean" <ColdFusion244@.gmail.com> wrote in message
news:ba587a67-ef18-452e-88a2-d6132234fc5c@.t54g2000hsg.googlegroups.com...
> You can do it visually, but the syntax goes like this:
> ALTER DATABASE [database name]
> SET RECOVERY [either: FULL | BULK_LOGGED | SIMPLE]
> Also, to see what the current recovery model is run: SP_HELPDB
> [database name]
> 1. Run SP_HELPDB [database name], and note the model used.
> 2. ALTER DATABASE [database name] SET RECOVERY BULK_LOGGED
> 3. Run SP_HELPDB [database name] to double check the settings
> 4. Run bcp import
> 5. ALTER DATABASE [databasename] SET RECOVERY (output of step 2)
> 6. SP_HELPDB [database name] to double check
>|||Thanks Rusell and Sean,
I have changed the model to "BULK_LOGGED" and used -b attribute in bcp import.
Smaller the batch size, faster is the data transfer
"Russell Fields" wrote:
> Shriharsha,
> When BCPing in so much data, it is also good to use the batch size operator
> to control the transaction size. Such as:
> bcp ... -b 50000
> This will break up your bcp into about 300 batches, which will speed it up
> and gives you more transaction log control. You could then (if necessary)
> run extra BACKUP LOGs during the bcp in.
> RLF
> "Sean" <ColdFusion244@.gmail.com> wrote in message
> news:ba587a67-ef18-452e-88a2-d6132234fc5c@.t54g2000hsg.googlegroups.com...
> > You can do it visually, but the syntax goes like this:
> >
> > ALTER DATABASE [database name]
> > SET RECOVERY [either: FULL | BULK_LOGGED | SIMPLE]
> >
> > Also, to see what the current recovery model is run: SP_HELPDB
> > [database name]
> >
> > 1. Run SP_HELPDB [database name], and note the model used.
> > 2. ALTER DATABASE [database name] SET RECOVERY BULK_LOGGED
> > 3. Run SP_HELPDB [database name] to double check the settings
> > 4. Run bcp import
> > 5. ALTER DATABASE [databasename] SET RECOVERY (output of step 2)
> > 6. SP_HELPDB [database name] to double check
> >
>
>

2012年2月13日星期一

Batch File.

I am creating one batch file which move datafile and logfile into different
machine but I want to ask one question like if one command successfully
executed then I have to wait for 20 seconds and then execute the second
command .... can any one know the command which I can use in batch file...
I think there should be any wait or delay sort of command available....
Thanks in advance.
Joh wrote:
> I am creating one batch file which move datafile and logfile into
> different machine but I want to ask one question like if one command
> successfully executed then I have to wait for 20 seconds and then
> execute the second command .... can any one know the command which I
> can use in batch file... I think there should be any wait or delay
> sort of command available....
>
> Thanks in advance.
If you kick off the batch file from a stored procedure or SQL batch
file, you can use the WAITFOR DELAY command to wait for 20 seconds.
David Gugick
Imceda Software
www.imceda.com
|||I have created the Batch File in which I wrote this...
NET STOP SQLSERVERAGENT
NET STOP MsSqlserver
COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\master.mdf"
C:\Backup\SystemDatabase
COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\mastlog.ldf"
C:\Backup\SystemDatabase
COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\msdbdata.mdf"
C:\Backup\SystemDatabase
COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\msdblog.ldf"
C:\Backup\SystemDatabase
NET START SQLSERVERAGENT
NET START MSSQLSERVER
Now I want to wait after first copy so what I have to write after that?
Thanks in advance.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:#spQKiNVFHA.1200@.TK2MSFTNGP14.phx.gbl...
> Joh wrote:
> If you kick off the batch file from a stored procedure or SQL batch
> file, you can use the WAITFOR DELAY command to wait for 20 seconds.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
|||Joh wrote:
> I have created the Batch File in which I wrote this...
> NET STOP SQLSERVERAGENT
> NET STOP MsSqlserver
> COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\master.mdf"
> C:\Backup\SystemDatabase
> COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\mastlog.ldf"
> C:\Backup\SystemDatabase
> COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\msdbdata.mdf"
> C:\Backup\SystemDatabase
> COPY "c:\Program Files\Microsoft SQL Server\MSSQL\Data\msdblog.ldf"
> C:\Backup\SystemDatabase
> NET START SQLSERVERAGENT
> NET START MSSQLSERVER
> Now I want to wait after first copy so what I have to write after
> that?
>
This is not a DOS newsgroup, and what I remember from those days is
somewhat limited. My suggestion was if you were using a stored procedure
to kick off the batch files, you could delay them using the waitfor
command. You would need to use xp_cmdshell to kick off the first batch
file, wait, then kick off the second, all from a stored procedure.
Why do you need to wait after the first copy?
David Gugick
Imceda Software
www.imceda.com
|||How can you start the SQL Service through SQL Stored procedure and through
XP_CMDSHELL .... ?
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:uI5jN6WVFHA.3044@.TK2MSFTNGP10.phx.gbl...
> Joh wrote:
> This is not a DOS newsgroup, and what I remember from those days is
> somewhat limited. My suggestion was if you were using a stored procedure
> to kick off the batch files, you could delay them using the waitfor
> command. You would need to use xp_cmdshell to kick off the first batch
> file, wait, then kick off the second, all from a stored procedure.
> Why do you need to wait after the first copy?
>
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
|||Joh wrote:
> How can you start the SQL Service through SQL Stored procedure and
> through XP_CMDSHELL .... ?
>
You can't. I only suggested it before I actually knew what you were
doing. You need to start SQL Server outside a stored procedure, for
obvious reasons.
David Gugick
Imceda Software
www.imceda.com