Thursday, March 29, 2012
Echo for SQL scripts
I want to see input SQL statements in the log file when I run the script in SQLPlus. I have used this set command "SET ECHO ON" for this. However, the log file looks like this -
drop table table_A
*
ERROR at line 1:
ORA-00942: table or view does not exist
7444 rows deleted.
Commit complete.
Thus, the SQL statement is not visible if it is error free. Is there a way to get around this?
ThanksDid you try to SPOOL the results?
This will do it:
SET ECHO ON
SPOOL logfile.log
@.MyScript
SPOOL OFF
;)|||I added these commands in my script -
set echo on
spool log_file.log
@.script_name.sql
spool off
the log file only had this error message -
SP2-0309: SQL*Plus command procedures may only be nested to a depth of 20.|||I added these commands in my script -
set echo on
spool log_file.log
@.script_name.sql
spool off
the log file only had this error message -
SP2-0309: SQL*Plus command procedures may only be nested to a depth of 20.
This error means what it means: your script executes a script that executes a script ...etc upto more that 20 levels deep.
:rolleyes:
Monday, March 26, 2012
Easy question about server log files
Is there a way to set up the SQL Server Log files so that it automatically creates a new one (or overwrites the old one) when the old one is full?
We keep having people shut out of our web site due to the log file being full. Since we have no DBA I volunteered to try to find out how we can avoid this faux pas in the future.
Thanks for your help!New idea for Microsoft !!!
If seriously may be it will be easier to backup transaction log more frequently (if full model) or increase maximal size of log because additional log files will only consume disk space until it is full.
It needs to find out why log is growing so fast - may be it is because of not closed transaction or something else.|||Sorry, but I'm new at this. Are we both talking about the same thing?
I'm not talking about the transaction log files that are backed up but of the log found under:
Management>SQL Server Logs
This log just shows what SQL Server has been doing, not what the users have been doing.
Perhaps you can tell me where the interface to make settings for this log can be found?|||Originally posted by Fly Girl
Sorry, but I'm new at this. Are we both talking about the same thing?
I'm not talking about the transaction log files that are backed up but of the log found under:
Management>SQL Server Logs
This log just shows what SQL Server has been doing, not what the users have been doing.
Perhaps you can tell me where the interface to make settings for this log can be found?
I am taking my words back...
Right click on SQL Server Log files/configure:
BOL:
Configure SQL Server Error Logs
Use this dialog box to view or specify the following options.
Options
Limiting the number of the error log files before they are recycled.
Check to limit the number of error logs created before they are recycled. A new error log is created each time an instance of Microsoft SQL Server is started. Typically, SQL Server retains backups of the previous six logs, unless you check this option, and specify a different maximum number of error log files below.
Maximum number of the error log files.
Specify the maximum number of error log files created before they are recycled. The default is six, which is the number of previous backup logs SQL Server retains before recycling them.|||Ok ... we need to get this clear ...
First of all .. I dont think it would be the SQL server error logs that are causing the problem.
Connect to the server ... using QA and run the following commands
exec xp_fixeddrives
and
sp_helpdb 'production_databasename'
Copy paste results and we will go further.|||Originally posted by snail
Specify the maximum number of error log files created before they are recycled. The default is six, which is the number of previous backup logs SQL Server retains before recycling them.
And you can create a scheduled to be run daily in SQL Server
Command to be executed in Job :-
dbcc errorlog|||OK, I think I've got this one ironed out now.
Thanks for the help!
Easy question
using Enterprise Manager. I am just learning.
What does the following statement do?
BACKUP LOG YourDatabase WITH Truncate_Only
Like if take the backup from Enterprise it creates .bak
files whether the above statement will also create
some .bak files.That command truncates the inactive portion of the transaction log without
taking a transaction log backup. Good from reducing the size of the
transaction log, but since no backup was taken you will not be able to
restore any data that was added, deleted, or updated if those data
modifications where contained in the inactive portion of the transaction
that is truncated.
--
----
----
-
Need SQL Server Examples check out my website
http://www.geocities.com/sqlserverexamples
<anonymous@.discussions.microsoft.com> wrote in message
news:3fa501c49ffd$1dc02350$a301280a@.phx.gbl...
> I generally do backups/restores of data and log files
> using Enterprise Manager. I am just learning.
> What does the following statement do?
> BACKUP LOG YourDatabase WITH Truncate_Only
> Like if take the backup from Enterprise it creates .bak
> files whether the above statement will also create
> some .bak files.
Easy question
using Enterprise Manager. I am just learning.
What does the following statement do?
BACKUP LOG YourDatabase WITH Truncate_Only
Like if take the backup from Enterprise it creates .bak
files whether the above statement will also create
some .bak files.
That command truncates the inactive portion of the transaction log without
taking a transaction log backup. Good from reducing the size of the
transaction log, but since no backup was taken you will not be able to
restore any data that was added, deleted, or updated if those data
modifications where contained in the inactive portion of the transaction
that is truncated.
----
-
Need SQL Server Examples check out my website
http://www.geocities.com/sqlserverexamples
<anonymous@.discussions.microsoft.com> wrote in message
news:3fa501c49ffd$1dc02350$a301280a@.phx.gbl...
> I generally do backups/restores of data and log files
> using Enterprise Manager. I am just learning.
> What does the following statement do?
> BACKUP LOG YourDatabase WITH Truncate_Only
> Like if take the backup from Enterprise it creates .bak
> files whether the above statement will also create
> some .bak files.
Thursday, March 22, 2012
Easy Admin Question
Services, when I log into the Report Manager website, I see the folder
"User Folders". I can navigate into that and see everyone's personal
"My Reports" folders.
Now, I have made a developer a Reporting Services Admin by adding him
to the RS Site Role of "System Admin" so that he can modify and
extract some user's reports that they saved in their My Reports
location.
For some reason he is unable to see the "User Folders" folder. I have
verified he is assigned to the System Admin role in RS so I'm unsure
what else I need to do to allow him to see the "User Folders" folder.
Any help anyone could provide is greatly appreciated!
Thanks in advance.
MartinSystem Administrator role does not include permissions to access catalog
items.
Quoting BOL (http://msdn2.microsoft.com/en-us/library/ms156470.aspx)
The System Administrator role is a predefined role that includes tasks that
are useful for a report server administrator who has overall responsibility
for a report server, but not necessarily for the content within it.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
<martinghale@.gmail.com> wrote in message
news:1173921810.864000.92000@.n59g2000hsh.googlegroups.com...
> OK, As an Admin on the server, domain, SQL Server and Reportin
> Services, when I log into the Report Manager website, I see the folder
> "User Folders". I can navigate into that and see everyone's personal
> "My Reports" folders.
> Now, I have made a developer a Reporting Services Admin by adding him
> to the RS Site Role of "System Admin" so that he can modify and
> extract some user's reports that they saved in their My Reports
> location.
> For some reason he is unable to see the "User Folders" folder. I have
> verified he is assigned to the System Admin role in RS so I'm unsure
> what else I need to do to allow him to see the "User Folders" folder.
> Any help anyone could provide is greatly appreciated!
> Thanks in advance.
> Martin
>|||Thank you Lev,
So after reading that and messing around with all the settings, I was
finely able to get it working. Had to set permissions at the Folder
and Report levels so that I, as an Admin, could 'control' a user's
reports they created and stored in their My Folders location.
Thanks for the link. It helped in my understanding and tracking this
down.
Monday, March 19, 2012
Dynamically set logging levels?
Hello All,
I suspect I know the answer but I'll ask away. We currently have our SSIS packages set up to log to SQL Server. Currently they log OnError, OnInformation and OnTaskFailed. If I'd like to have it log OnPipeLineRowsSent, is there anyway I can get that done without opening up the package and editing it? I know the change is trivial from the IDE but the deployment process at my current engagement is quite lengthy. If something breaks in production, I'd like to know if it'll be possible to turn up the chattiness of logging without going through a full deploy scenario.
I was looking at the parameters for dtexec/dtexecui and I see that you can configure where something logs but nothing about the verbosity of the logs generated. Is it something I'm missing with that or is that all you can set there?
The only other option that jumps out at me is to develop a custom script or component that sets the logging level based on a parameter. Anyone have a thought as to how much effort that would besomething easily tackled or probably more trouble that it's worth?
Thanks for the help
I don't think you can send parameters to the logging provider because logging occurs before pretty much any thing else. See this post for more details:http://weblogs.sqlteam.com/dmauri/archive/2006/04/02/9489.aspx