Skip to Main Content

Oracle Database Free

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

sqlplus argument reset problem

Harry Zhang5 days ago

In sqlplus 23i, if in first script you use argumnet command for 1st parameter as prompt, then later in another script use argument for first parameter and provide default value, the second script still prompting user for input if both scripts run in one login session. I would expect the argument command is reset to the default value one in the second script. Please see below test case.

1.sql
argument 1 prompt "Enter the table name:"
argument 2 default 10

select '&1' "table" from dual;

2.sql
argument 1 default 10
define num_rows = &1

select '&num_rows' num_rows from dual;

Ouput as below(when running 2.sql, it is still prompting Enter the table name:)
=============

SQL> @1.sql
**Enter the table name:**t1
old 1: select '&1' "table" from dual
new 1: select 'test' "table" from dual

tabl
----
t1

1 row selected.

Elapsed: 00:00:00.01
SQL> @2.sql
**Enter the table name:**t2
old 1: select '&num_rows' num_rows from dual
new 1: select 't2' num_rows from dual

NU
--
t2

1 row selected.

Comments

Hi.,

May i know which version of database you are using, Is it 19C, if 19C DB then, you are importing into the CDB or Any of PDB Database?

Based on your export command you have issued., I have given 2 scenario to perform as shown below.

expdp user/pass schemas=ctm920 directory=BACKUP_DIRDC logfile=backup.log filesize=1G

If you are using import on Container Database (CDB)

- Check the OS Directory is created & you have linked this OS Directory to DB directory.
Ex: $ mkdir -p /u01/dumpfile/
- Place dumpfile into /u01/dumpfile location.
- SQL> create or replace directory dumpfile as '/u01/dumpfile/';
- SQL> grant read, write on directory dumpfile to [import user];

impdp user/pass dumpfile=expdat.dmp logfile=imp_log.log directory=BACKUP_DIRDC TABLE_EXISTS_ACTION=REPLACE

If you are using import on Pluggable Database (PDB)

- Check the OS Directory is created & you have linked this OS Directory to DB directory.
Ex: $ mkdir -p /u01/dumpfile/
- Place dumpfile into /u01/dumpfile location.
- SQL> create or replace directory dumpfile as '/u01/dumpfile/';
- SQL> grant read, write on directory dumpfile to [import user];

impdp user/pass@(PDB NAME) dumpfile=expdat.dmp logfile=imp_log.log directory=BACKUP_DIRDC TABLE_EXISTS_ACTION=REPLACE

Keep us update.

Warm Regards,
Mir Sayeed Hassan
Oracle ACE Pro
Oracle Certified OCP | OCI

Solomon Yakobson 5 days ago

impdp parameter TABLE_EXISTS_ACTION=REPLACE applies to tables only. Errors you are getting indicate FUNCTION:"ctm920 "."CURRTIME", PROCEDURE:"ctm920 "."PURGE_CMR_RUNINF_1" and FUNCTION:"ctm920 "."DDIFF" already exist in target database. You need to decide do you want to keep there existing objects and for that you need to add EXCLUDE parameters to import or import them and for that you need to drop these objects before import.

SY.

1 - 2

Post Details

Added 5 days ago
0 comments
45 views