Home » Infrastructure » Unix » Variables from SQLPLUS to UNIX
Variables from SQLPLUS to UNIX [message #276915] Fri, 26 October 2007 15:39 Go to next message
seethem
Messages: 41
Registered: September 2007
Member
So how do I retrieve that SCN number back into a SQL Script?

I want to do the following:

sqlplus -s $user/$pass <<EOF
select current_scn from v$database;
exit
EOF

expdp $user/$pass@$db flashback_scn=$current_scn full=y


How do I extract that current_scn?


Thanks in advance,
Phillip
Re: Variables from SQLPLUS to UNIX [message #276918 is a reply to message #276915] Fri, 26 October 2007 16:44 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
sqlplus -s $user/$pass <<EOF
spool myexpdp.sh
select 'expdp $user/$pass@$db flashback_scn='||current_scn||'  full=y' from v$database;
spool off
exit
EOF
sh -x myexpdp.sh

[Updated on: Fri, 26 October 2007 16:44] by Moderator

Report message to a moderator

Re: Variables from SQLPLUS to UNIX [message #278491 is a reply to message #276918] Sun, 04 November 2007 13:55 Go to previous messageGo to next message
seethem
Messages: 41
Registered: September 2007
Member
Hi Ana,

Thanks...

Here is my script...
-------------------------------------
export VIEW="v\$database"

EXPORT=`sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} <<EOF
set feed off head off timing off linesize 250
spool /home/oracle/result.out
select 'exp ${USERNAME}/${PASSWORD}@${ORACLE_SID} file=${BACKUP_PATH}/${TAG}.DMP log=${EXPLOG}/EXP_${TAG}.LOG buffer=100000 statistics=none flashback_scn='||current_scn||' full=y' from ${VIEW};
spool off
exit
EOF`
-------------------------------------

Question:
===========
If I am kicking this script off of a client machine, using Oracle 10g client tools, how can I make this script run server side?

Considering that when I use RMAN from the client side, I am able get the backed up files stored on the server side. Which is what I want.
Is it that I need to use datapump or can binary exports do the trick for me.
Re: Variables from SQLPLUS to UNIX [message #278498 is a reply to message #278491] Sun, 04 November 2007 14:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
See my answer in the other topic you posted it.

Regards
Michel
Re: Variables from SQLPLUS to UNIX [message #278511 is a reply to message #276915] Sun, 04 November 2007 18:50 Go to previous message
seethem
Messages: 41
Registered: September 2007
Member
Hi Michel,

Thanks....
I figured that I should not have posted that one here after I did.

Thanks all the same.
Previous Topic: compiling a list of pkgs in a directory
Next Topic: Help me to unistall Oracle in Solaris 10
Goto Forum:
  


Current Time: Sat Nov 23 20:40:22 CST 2024