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

Post, not working, please help
The error is:
Method Not Allowed
The requested method POST is not allowed for the URL /student

Why does this file not return file names that start with numbers?
This file returns a list of filenames to help populate a drop down in my form. For some reason it ig

Hardcopy printing is to wide
I want to make a hardcopy at runtime of my active form like this

Hyperlink is adding an extra gap to variable
Hi, here's my problem..

I have a php generated page with a hyperlink which opens in a new win

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

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

Error in write byte array into document in SM58
Hi Gurus,

Getting the following error status in Transactional RFC (SM58) ..... *Error i

Interpret Order
Hello all,

I'm wondering if I have this:

Code: $switch = array(
'one' =>

All possible combinations of Strings from table in PL/SQL
Hi,

I am trying to figure out how to build a list of all possible string combinations fro

how do I show what a user have selected from a checkbox?
From my code below, how would i show which check boxes have been checked and which radio buttons sel

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