Project:Sandbox

http:///pagename Escrever Wiki parece fácil.. Será que dá para copiar e "em itálico" colar Negrito Agora sim --189.32.229.128 00:34, 20 January 2012 (UTC) www.oracle.com.br
 * 1) Listar
 * 2) Listar2
 * 3) listar3

Script BAT e Default sqlplus

segunda-feira, 4 de agosto de 2008 12:39

Exemplo de script dos

setlocal

@( echo spool d:\orcoop\tmp\sql.sql echo set head off echo set feed off echo select 'alter tablespace '^|^|tablespace_name^|^|' begin backup;' from dba_tablespaces where tablespace_name ^<^> 'TSTUNI'^; echo select 'exit' from dual^; echo exit ) >d:\orcoop\tmp\sqltmp.sql

set ORACLE_SID=orcoop sqlplus -s "/ as sysdba" @d:\orcoop\tmp\sqltmp.sql sqlplus -s "/ as sysdba" @d:\orcoop\tmp\sql.sql

del d:\orcoop\tmp\gerbegin.sql del d:\orcoop\tmp\sql.sql

Geração de sql

set head off set feed off set newpage none Set linesize 2000

select * from abc

exit

mt -f /dev/nst0 eod mt -f /dev/nst0 bsfm 2 tar tzvf /dev/nst0 (Catalogo)

mt -f /dev/nst0 rewind mt -f /dev/nst0 fsf 1 -> 2o arquivo gravado na fita

SET SQLPROMPT pré 10g

undefine usr db col usr new_value usr col db new_value db

set termout off select lower(user) usr, substr(global_name, 1, instr(global_name, '.')-1) db from   global_name / set termout on

set sqlprompt '&&usr.@&&db.> '

Colado de  login.sql

col prom new_value prom set termout off define prom='NOT CONNECTED' select upper(sys_context('USERENV','SESSION_USER'))|| '@'|| upper(sys_context('USERENV','DB_NAME')) prom

from dual; set sqlprompt "&prom> " set termout on

connect.sql

connect &1 @login.sql

Colado de 

SET SQLPROMPT 10g

$ORACLE_HOME/sqlplus/admin/glogin.sql => set sqlprompt '_user"@"_connect_identifier> '

http://www.oracle.com/technology/support/tech/sql_plus/htdocs/sub_var2.html#2_4

Exemplo de Script Linux

ORACLE_SID=dtex ORACLE_HOME=/oracle/ora10g LOG=/oracle/oradata/dtex/trc/bat/wt_backup.log export ORACLE_SID ORACLE_HOME

if [ -f /oracle/oradata/dtex/bat/backup.online ]; then echo " BACKUP AINDA ATIVO " >$LOG 2>$LOG exit 0; fi

echo " BACKUP" >/oracle/oradata/dtex/bat/backup.online $ORACLE_HOME/bin/sqlplus /nolog >$LOG 2>$LOG <<EOF connect system/soradmin

spool /oracle/oradata/dtex/trc/bat/wt_backup.log set echo on

alter tablespace system begin backup; !cp /oracle/oradata/dtex/dbf/system?.ora /oracle/oradata/dtex/bak alter tablespace system end backup;

!cp /oracle/oradata/dtex/dbf/temp?.ora /oracle/oradata/dtex/bak

alter database backup controlfile to trace noresetlogs; alter database backup controlfile to '/oracle/oradata/dtex/bak/controlbackup.ctl' reuse ;

!cp /oracle/oradata/dtex/log/* /oracle/oradata/dtex/bak

spool off exit EOF

mv $LOG /oracle/oradata/dtex/trc/bat/wt_backup.`date +%y%m%d%H%M` find /oracle/oradata/dtex/bak/* -ctime +7 -exec rm {} \; find /oracle/oradata/dtex/arc/* -ctime +7 -exec rm {} \; find /oracle/oradata/dtex/trc/* -ctime +7 -exec rm {} \;

rm -f /oracle/oradata/dtex/bat/backup.online