Showing posts with label log. Show all posts
Showing posts with label log. Show all posts

Monday, March 26, 2012

How to get the log file with /logger option

Hi,

I want to get the log for the below command.

DTExec /FILE "C:\Test.dtsx" /CONNECTION DestinationConnectionFlatFile;"c:\test.csv" /CONNECTION SourceConnectionOLEDB;"Data Source=test;User ID=user;Initial Catalog=DATA_CONV;Provider=SQLNCLI;Auto Translate=false;PASSWORD=password" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EWCDI /logger "DTS.LogProviderTextFile;log.txt" /Set "\package.Connections[log.txt].Properties[ConnectionString];c:\log.txt"

But I got the error as below. Please advise.

Error: 2006-10-10 09:57:21.07
Code: 0xC001000E
Source: Test
Description: The connection "log.txt" is not found. This error is thrown by C
onnections collection when the specific connection element is not found.
End Error
Error: 2006-10-10 09:57:21.10
Code: 0xC001000E
Source: Test
Description: The connection "log.txt" is not found. This error is thrown by Connections collection when the specific connection element is not found.
End Error
Warning: 2006-10-10 09:57:21.14
Code: 0x8001F02F
Source: Test
Description: Cannot resolve a package path to an object in the package ".Connections[log.txt].Properties[ConnectionString]". Verify that the package path is valid.
End Warning
Warning: 2006-10-10 09:57:21.17
Code: 0x80012017
Source: Test
Description: The package path referenced an object that cannot be found: "\package.Connections[log.txt].Properties[ConnectionString]". This occurs when an attempt is made to resolve a package path to an object that cannot be found.
End Warning
DTExec: Could not set \package.Connections[log.txt].Properties[ConnectionString]
value to c:\log.txt.

Are you using dtexecui.exe to build the command line? If not, please do that, as it will build properly formed dtexec parameter set.

If you want to add a logger from the command line, it must reference a pre-existent connection manager in the package. So add a file connection manager to the package.

Now if you want a logger without a pre-existent connection manager, and you don't mind coding, create your own LogProvider by creating a subclass of LogProviderBase and overriding of meaning of the ConfigString, when generally points to a connection manager in stock loggers.

Two custom log providers with source code are available in the SQL 2005 samples available at http://www.microsoft.com/downloads/details.aspx?FamilyID=E719ECF7-9F46-4312-AF89-6AD8702E4E6E&displaylang=en

Wednesday, March 21, 2012

How to get the correct error message

Hi Everyone!

In my stored procedure I check for any errors during .
If there are any errors I log them. (by checking @.@.ERROR)

What my problem is, the error message that's been logged contain place holders like %s, %l, %d,etc. along with the error message.

How can I get the full error message, with place holders replaced by real error values/text?

Here is a sample what I get as the error:

* Error ID: 547
* Error Desc: %ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.

using this query
SELECT @.errdesc=description FROM master.dbo.sysmessages WHERE error = @.errid

When I run the stored proc in Query Analyser it gives the actual error message as:

Server: Msg 547, Level 16, State 1, Procedure sp_register_change, Line 366
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_TBL_EQUIPMENT'. The conflict occurred in database 'EquipManWT', table 'TBL_EQUIPMENT', column 'unitno'.
The statement has been terminated.

Thanks heaps,

rochanaFORMATMESSAGE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_fa-fz_0kv9.asp),
Using RAISERROR (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_05_3f76.asp) ?|||Thanx for your reply buser

Well.. I could use FORMATMESSAGE if i know the parameter values to pass. Because the system issued the RAISERROR I do not have a way of retrieving (or passing) the parameter values to FORMATMESSAGE

I do not know if there is a way to get parameter values for the error raised by the sql server.

But I think there should be a way, because the Query Analyzer displays the full error message when I execute the stored proc in there.

I hope what I am telling is clear :)

Syntax

FORMATMESSAGE ( msg_number , param_value [ ,...n ] )|||I think not... :( Because who is catching error also should do form the message for a mistake... In this case do rase exception sql server...
You can write any errors (or some) to SQL server log file and then using DTS transfer this to some table...
I ask me to correct if it not so...
Sorry for my english :)
see sysmessages col:=dlevel (0x80) and
sp_altermessage [ @.message_id = ] message_number
, [ @.parameter = ] 'write_to_log'
, [ @.parameter_value = ] 'value'|||Hi Buser

One guy pointed me to this on another forum.

http://www.nigelrivett.net/spFormatOutputBuffer.html

And it seems to give the full error message, but not properly formatted.

Thanks for ur help|||Permissions
DBCC OUTPUTBUFFER permissions default only to members of the sysadmin fixed server role, who can see any SPID. Permissions are not transferable.

select @.cmd = 'dbcc outputbuffer(' + convert(varchar(10),@.spid) + ')'
exec (@.cmd)|||yes. can only view if u have admin rights :(

Monday, March 19, 2012

How to get source IP address of a database connection

Hi,
Is there a way to find out the source IP address of a database connection?
In trace there are only netbios names available, while I need to log the IP
addresses that connect to the database.
Thx,
Jacek Skaznik
We store the MAC address in sysprocesses while the connection is there. If
you query master..sysprocesses you'll see it, but we don't map the MAC to
an IP.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

How to get source IP address of a database connection

Hi,
Is there a way to find out the source IP address of a database connection?
In trace there are only netbios names available, while I need to log the IP
addresses that connect to the database.
Thx,
Jacek SkaznikWe store the MAC address in sysprocesses while the connection is there. If
you query master..sysprocesses you'll see it, but we don't map the MAC to
an IP.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Monday, March 12, 2012

How To Get Rid Of Sql Log

Hi,
I have a Data base on Sql Server 2000, sp3a. Database is used to to build summary tables to show reports on web. There are many sub systems, which prepare summarized tables for faster web page serving. Every thing is working fine.

The problem is sql server log gets full. In one given day it could go up to 18 GB. I know, if I back it up it gets truncated. Is there a way, I can stop sql server not to log, as it is not needed?

Can I set up Sql server to automatically truncate it. I do have auto shrink options checked, but log file still keeps growing.

Any idea, what is going on here.
Thanks,
Mashro::Is there a way, I can stop sql server not to log, as it is not needed?

You err, it IS needed.

Read up in the documentation what the log is used for. It is needed.|||Back it up regularly to keep it from growing out of control. You can't eliminate the log. It's a pretty key piece of the puzzle. If you have the db set to simple recovery, it should truncate the log on each checkpoint. Probably no need to use a full recovery model on a 'derived' reporting database like you seem to have.

Friday, March 9, 2012

How to get Procedure call text from within SQL Stored Procedure

Hi,
I'm using SQL Server 2005.
I have implemented some SPs with the TRY..CATCH structure and each time
that I have an error, I just log it into a dedicated LogError table.
I would like to add in LogError a column containing the command that
was used by the user (containing the Procedure Name and the calling
parameters)
Is there any way to perform it ?
Thanks
PFI
have a look at
http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
The bits with
dbcc inputbuffer
and
fn_get_sql
Get the sql executed if it is available.
dbcc inputbuffer is more likely to have the user command.
Neither is guaranteed.
www.nigelrivett.net
*** Sent via Developersdex http://www.codecomments.com ***
|||Thanks a lot.
dbcc inputbuffer was exactly what I was looking for.
PFI
nigelrivett a crit :

> have a look at
> http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
> The bits with
> dbcc inputbuffer
> and
> fn_get_sql
> Get the sql executed if it is available.
> dbcc inputbuffer is more likely to have the user command.
> Neither is guaranteed.
> www.nigelrivett.net
>
> *** Sent via Developersdex http://www.codecomments.com ***

How to get Procedure call text from within SQL Stored Procedure

Hi,
I'm using SQL Server 2005.
I have implemented some SPs with the TRY..CATCH structure and each time
that I have an error, I just log it into a dedicated LogError table.
I would like to add in LogError a column containing the command that
was used by the user (containing the Procedure Name and the calling
parameters)
Is there any way to perform it ?
Thanks
PFIhave a look at
http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
The bits with
dbcc inputbuffer
and
fn_get_sql
Get the sql executed if it is available.
dbcc inputbuffer is more likely to have the user command.
Neither is guaranteed.
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***|||Thanks a lot.
dbcc inputbuffer was exactly what I was looking for.
PFI
nigelrivett a =E9crit :
> have a look at
> http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
> The bits with
> dbcc inputbuffer
> and
> fn_get_sql
> Get the sql executed if it is available.
> dbcc inputbuffer is more likely to have the user command.
> Neither is guaranteed.
> www.nigelrivett.net
> > > *** Sent via Developersdex http://www.developersdex.com ***

How to get Procedure call text from within SQL Stored Procedure

Hi,
I'm using SQL Server 2005.
I have implemented some SPs with the TRY..CATCH structure and each time
that I have an error, I just log it into a dedicated LogError table.
I would like to add in LogError a column containing the command that
was used by the user (containing the Procedure Name and the calling
parameters)
Is there any way to perform it ?
Thanks
PFIhave a look at
http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
The bits with
dbcc inputbuffer
and
fn_get_sql
Get the sql executed if it is available.
dbcc inputbuffer is more likely to have the user command.
Neither is guaranteed.
www.nigelrivett.net
*** Sent via Developersdex http://www.codecomments.com ***|||Thanks a lot.
dbcc inputbuffer was exactly what I was looking for.
PFI
nigelrivett a =E9crit :

> have a look at
> http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
> The bits with
> dbcc inputbuffer
> and
> fn_get_sql
> Get the sql executed if it is available.
> dbcc inputbuffer is more likely to have the user command.
> Neither is guaranteed.
> www.nigelrivett.net
>=20
>=20
> *** Sent via Developersdex http://www.codecomments.com ***

Wednesday, March 7, 2012

How to get number of transactions from log ?

Is there way to get the number of transactions from the SQL Server log, by
using some extended procedures ?
-NagsNags wrote:
> Is there way to get the number of transactions from the SQL Server
> log, by using some extended procedures ?
You may view the transaction log contents by executing:|||Nags wrote:
> Is there way to get the number of transactions from the SQL Server
> log, by using some extended procedures ?
You may view the log contents by executing DBCC log, but I don't know if it
works for you. See for yourself:
DBCC log ( {dbid|dbname}, [, type={0|1|2|3|4}] )
PARAMETERS:
Dbid or dbname - Enter either the dbid or the name of the database in
question.
type - is the type of output:
0 - minimum information (operation, context, transaction id)
1 - more information (plus flags, tags, row length)
2 - very detailed information (plus object name, index name, page id, slot
id)
3 - full information about each operation
4 - full information about each operation plus hexadecimal dump of the
current transaction log's row.
by default type = 0
To view the transaction log for the master database, you can use the
following command:
DBCC log (master)
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.

How to get new sql server logs without restart SQL server (not SQL transaction log)

hi
I'm using SQL 2000 SP4 on Win2003 Server
By default, when we restart the SQL server, the new "sql server logs" will
be created, my question is, how to achieve the same result by NOT restart
the SQL server
Thanks a lot> By default, when we restart the SQL server, the new "sql server logs" will
> be created, my question is, how to achieve the same result by NOT restart
> the SQL server
EXEC sp_cycle_errorlog
--
Hope this helps.
Dan Guzman
SQL Server MVP
"gbkhor" <gbkhor@.time.net.my> wrote in message
news:uJSGIj4UIHA.6060@.TK2MSFTNGP05.phx.gbl...
> hi
> I'm using SQL 2000 SP4 on Win2003 Server
> By default, when we restart the SQL server, the new "sql server logs" will
> be created, my question is, how to achieve the same result by NOT restart
> the SQL server
> Thanks a lot
>|||Thanks Dan, it work well
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:1E79D060-BADE-4703-9E23-EB3D374F27F9@.microsoft.com...
>> By default, when we restart the SQL server, the new "sql server logs"
>> will be created, my question is, how to achieve the same result by NOT
>> restart the SQL server
> EXEC sp_cycle_errorlog
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "gbkhor" <gbkhor@.time.net.my> wrote in message
> news:uJSGIj4UIHA.6060@.TK2MSFTNGP05.phx.gbl...
>> hi
>> I'm using SQL 2000 SP4 on Win2003 Server
>> By default, when we restart the SQL server, the new "sql server logs"
>> will be created, my question is, how to achieve the same result by NOT
>> restart the SQL server
>> Thanks a lot
>

How to get new sql server logs without restart SQL server (not SQL transaction log)

hi
I'm using SQL 2000 SP4 on Win2003 Server
By default, when we restart the SQL server, the new "sql server logs" will
be created, my question is, how to achieve the same result by NOT restart
the SQL server
Thanks a lot
> By default, when we restart the SQL server, the new "sql server logs" will
> be created, my question is, how to achieve the same result by NOT restart
> the SQL server
EXEC sp_cycle_errorlog
Hope this helps.
Dan Guzman
SQL Server MVP
"gbkhor" <gbkhor@.time.net.my> wrote in message
news:uJSGIj4UIHA.6060@.TK2MSFTNGP05.phx.gbl...
> hi
> I'm using SQL 2000 SP4 on Win2003 Server
> By default, when we restart the SQL server, the new "sql server logs" will
> be created, my question is, how to achieve the same result by NOT restart
> the SQL server
> Thanks a lot
>
|||Thanks Dan, it work well
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:1E79D060-BADE-4703-9E23-EB3D374F27F9@.microsoft.com...
> EXEC sp_cycle_errorlog
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "gbkhor" <gbkhor@.time.net.my> wrote in message
> news:uJSGIj4UIHA.6060@.TK2MSFTNGP05.phx.gbl...
>

Friday, February 24, 2012

How to get log shipping to work with log backups?

How exactly are you supposed to get log shipping to work
with log backups? I have the production server which
backups up logs every two hours on the hour. I have
another server which I am log shipping to. I set it up to
log ship every 55 minutes. The second time around it
failed. I don't get it how are you supposed to set this up.
?
I'm not too sure what error you received but this should work OK. Try
manually restoring the logs and then adjust the copy and load frequencies to
be every 15 minutes. This will definitely avoid any issues with backlogs. If
this doesn't work then something else is wrong in the setup and in this case
please post up any error messages , info from the monitor, info about whick
logs have been copied over etc.
Regards,
Paul Ibison
|||It says that the log sequence number is not in synch that
it needs an earlier transaction log. When I copy over the
backup of the transaction log that was made from the other
maintenance plan for transaction logs I was able to apply
it no problem.
I just want to get rid of the other maintence plan
altoghter. What I am worried about is will log shipping
truncate the log when it's done. I don't want the
transaction log to grow indefinitely.
Or if I am totally wrong in my thinking here please advise.
Thanks,
Bryan
>--Original Message--
>I'm not too sure what error you received but this should
work OK. Try
>manually restoring the logs and then adjust the copy and
load frequencies to
>be every 15 minutes. This will definitely avoid any
issues with backlogs. If
>this doesn't work then something else is wrong in the
setup and in this case
>please post up any error messages , info from the
monitor, info about whick
>logs have been copied over etc.
>Regards,
>Paul Ibison
>
>.
>
|||Bryan,
backup of the log truncates it unless NO TRUNCATE is specified, and this is
not the default on log shipping, so Yes, it will truncate. Having 2
maintenance plans to backup the logs, one of which is used for log shipping
is not something I've ever tested, but logically it looks sure to fail due
to non-contiguous LSNs. In your case I'd remove both plans, and recreate the
log-shipping one.
HTH,
Paul Ibison

How to get list of backup log files from msdb of standby server?

How do we retrieve log file names of primary backup from msdb of
standby database?
In case of primary server unavailable, I need to get the logfile names
from standby server for disater recovery test.
Thanks in advance
Tram
Msdb..backupfile gives you a list of data/log files that are backed up.
For logshipping, take a look at msdb..log_shipping_plan_databases.
-oj
"tram" <tram_e@.hotmail.com> wrote in message
news:1120079449.879078.169120@.o13g2000cwo.googlegr oups.com...
> How do we retrieve log file names of primary backup from msdb of
> standby database?
> In case of primary server unavailable, I need to get the logfile names
> from standby server for disater recovery test.
> Thanks in advance
> Tram
>

How to get list of backup log files from msdb of standby server?

How do we retrieve log file names of primary backup from msdb of
standby database?
In case of primary server unavailable, I need to get the logfile names
from standby server for disater recovery test.
Thanks in advance
TramMsdb..backupfile gives you a list of data/log files that are backed up.
For logshipping, take a look at msdb..log_shipping_plan_databases.
-oj
"tram" <tram_e@.hotmail.com> wrote in message
news:1120079449.879078.169120@.o13g2000cwo.googlegroups.com...
> How do we retrieve log file names of primary backup from msdb of
> standby database?
> In case of primary server unavailable, I need to get the logfile names
> from standby server for disater recovery test.
> Thanks in advance
> Tram
>

How to get list of backup log files from msdb of standby server?

How do we retrieve log file names of primary backup from msdb of
standby database?
In case of primary server unavailable, I need to get the logfile names
from standby server for disater recovery test.
Thanks in advance
TramMsdb..backupfile gives you a list of data/log files that are backed up.
For logshipping, take a look at msdb..log_shipping_plan_databases.
--
-oj
"tram" <tram_e@.hotmail.com> wrote in message
news:1120079449.879078.169120@.o13g2000cwo.googlegroups.com...
> How do we retrieve log file names of primary backup from msdb of
> standby database?
> In case of primary server unavailable, I need to get the logfile names
> from standby server for disater recovery test.
> Thanks in advance
> Tram
>

How to get last lsn for my DB

I need to restore multiple set file from a transaction log backup.
To know from which position of this file starting my restore, i need to know
the last lsn point restored on my DB.
while @.id_start < @.id_stop
begin
set @.id_start = @.id_start + 1
RESTORE LOG [MYDB]
FROM DISK = N'Y:\MYDB_LOG'
WITH STANDBY = 'C:\Programmi\Microsoft SQL Server\MSSQL\UNDO_MYDB.ldf',
FILE = @.id_start
if @.@.error > 0
begin
set @.id_stop = 0
BREAK
end
end
I need to know the @.id_start to begin the restore for all backup set missing
.
ThanksHi
RESTORE DATABASE test FROM disk = 'd:\db.bak' WITH FILE = 1, norecovery
RESTORE LOG test FROM disk = 'd:\log.bak' WITH FILE = 1, norecovery
RESTORE LOG test FROM disk = 'd:\log.bak' WITH FILE = 2, norecovery
RESTORE LOG test FROM disk = 'd:\log.bak' WITH FILE = 3, recovery
"checcouno" <checcouno@.discussions.microsoft.com> wrote in message
news:7BF739FD-E00E-4C13-ABDF-75CC564F31CD@.microsoft.com...
> I need to restore multiple set file from a transaction log backup.
> To know from which position of this file starting my restore, i need to
know
> the last lsn point restored on my DB.
>
> while @.id_start < @.id_stop
> begin
> set @.id_start = @.id_start + 1
> RESTORE LOG [MYDB]
> FROM DISK = N'Y:\MYDB_LOG'
> WITH STANDBY = 'C:\Programmi\Microsoft SQL
Server\MSSQL\UNDO_MYDB.ldf',
> FILE = @.id_start
> if @.@.error > 0
> begin
> set @.id_stop = 0
> BREAK
> end
> end
> I need to know the @.id_start to begin the restore for all backup set
missing.
> Thanks