[askdba] Re: [dba_gurus] How to get user&db name for spool file name?

  • From: Nisar Tareen <ntareen@xxxxxxxxx>
  • To: dba_gurus@xxxxxxxxxxxxxxx, askdba <askdba@xxxxxxxxxxxxx>
  • Date: Fri, 3 Jun 2005 20:53:21 -0700 (PDT)

Thats what I use in front of all my batch reports 
set term on

set trimspool on

column val new_value dname

select rtrim(value,8)||'_Tuning_' ||to_char(sysdate,'dd_MM_YYYY_HH24MI') val 

from v$parameter 

where name = 'db_name';


spool &&dname..log

rem spool db_tune_rep.out


Nisar Tareen 

Thiagoo <thiagoodba@xxxxxxxxx> wrote:

I'm executing one query thru several users for several databases. I need to get 
the spool file name as filename_user_db.lst, how can I get this? Later on I 
need to verify which user executed this file on which database.

I'm generating a script, which will be executed later...!

For ex.,
I'm doing like this..now..manually entering the user name & db name..!

set head off;
set pages 10000;
set lines 120;
set feedback off;
set echo off;
spoo enable_cons_devl_kxtrnd .sql <= THE NEW SPOOL FILE NAME SHUD COME HERE 
select 'spoo enable_cons_devl_kxtrnd; ' from dual ;
select 'set feedback on; ' from dual ;
select 'set echo on; ' from dual ;
select 'Alter Table '||owner||'.'||table_name||' Enable Constraint '||chr(10)||
constraint_name||' ; '
from user_constraints
where status='DISABLED';
select 'spoo off ; ' from dual ;
spoo off;

The above script will generate enable_cons_devl_kxtrnd.sql, which when executed 
will generate enable_cons_devl_kxtrnd.lst.



Thanks & Best Regards,



Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

[Non-text portions of this message have been removed]

Yahoo! Groups Links

   To visit your group on the web, go to:
   To unsubscribe from this group, send an email to:
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

Discover Yahoo!
 Find restaurants, movies, travel & more fun for the weekend. Check it out!

Other related posts:

  • » [askdba] Re: [dba_gurus] How to get user&db name for spool file name?