Pass sql into pl/sql and create RMAN duplicate script.


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm new to pl/sql and I'm trying to write a script that will generate some RMAN commands to do a database clone.

I want to able to run the script and it prompt me for variables to be used in the script.

I've done some research but I've been unable to find any examples of how to do this.

Basic script is (there would obviously be a lot more to the final script):

declare

dbname varchar2(9) := &dbname;

BEGIN
DBMS_OUTPUT.ENABLE(2000);
DBMS_OUTPUT.PUT_LINE(' DUPLICATE TARGET DATABASE TO '|| dbname ||';');
end;
/

Gives me:

Enter value for dbname: ORCL4
old 3: dbname varchar2(9) := &dbname;
new 3: dbname varchar2(9) := ORCL4;
dbname varchar2(9) := ORCL4;
*
ERROR at line 3:
ORA-06550: line 3, column 24:
PLS-00201: identifier 'ORCL4' must be declared
ORA-06550: line 3, column 9:
PL/SQL: Item ignored
ORA-06550: line 7, column 66:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 7, column 9:
PL/SQL: Statement ignored

Thanks,

No comments posted yet

Your Answer:

Login to answer
277 Like 49 Dislike
Previous forums Next forums
Other forums

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

Slow data retrieval which requires improvement..please help
I am working on a Help Desk Ticketing system and have a page called MY TICKETS which shows all ticke

Problem with php's rename function
So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempt

DOMDocument
Hello All,

I need to take an XML document, modify some of the nodes in it and then perform a

Whats wrong with my query?
I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are

set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli

Save User Inputs while javascript reloading!
hi..
i have written a PHP code in which i reload the page when user selects a value in dropdown..

reading xml faster than DB call?
I am trying to optimize a high traffic website, and I enabled a feature where there are three photos

Staff Induction System - No idea where to go from here!!!
Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right directi

animation progress while uploading files?
Hello, i have some website form to upload few files to server. i want to put some gif animation whi

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash