ORA-01919: role 'RESTRICTED_ROLE1' does not exist - oracle

I am getting this error while trying to import with impdp
expdp system/system schema=ieulive directory=data_pump dumpfile=IEULIVE2.DMP logfile=exp.log
at export, all good
imp system/system remap_schema=ieulive:ieu1 directory=dir1 dumpfile=IEULIVE2.DMP logfile=imp.log
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
ORA-39083: Object type ROLE_GRANT failed to create with error:
ORA-01919: role 'RESTRICTED_ROLE1' does not exist
Failing sql is:
GRANT "RESTRICTED_ROLE1" TO "IEULIVE" WITH ADMIN OPTION
.
.
.
.
also tried with
expdp ieulive/ieulive directory=data_pump dumpfile=IEULIVE2.DMP logfile=exp.log
impdp ieu1/ieu1 directory=dir1 dumpfile=IEULIVE2.DMP logfile=imp.log
not sure what the difference between two methods, but anyway I got the same result
Help Appreciated.

#scapy answered the question in the question comment, I bosted the answer to accept as solution.
create role restricted_role1;
then import.

Related

Oracle Import Data dump: tablespace: "USERS" already exist

I am trying to import data using impdp in oracle. However, when I tried to import it, it is giving me the following error:
ORA-29349: tablespace "USERS" already exists
Since USERS is the defualt permenant tablespace that contains users objects, I tried to exclude it from the command by adding
"exclude=tablespace:\" IN ('USERS')\""
However, adding that does not help at all as the error remains.
my command looks like following: "impdp SYSTEM/MYPASSWORD#orcl full=Y DIRECTORY=dir dumpfile=mydump.dmp LOGFILE=mydump.dmp.log exclude=tablespace:\" IN ('USERS')\" transport_datafiles='/path/to/file"
Any help is appreciated
Ok, from what I can tell this isn't just a normal "can't create tablespace" error. This error is specific to using transportable tablespaces. In this case you won't be able to ignore. The work around is to rename the existing tablespace:
alter tablespace users rename to users_ts;
Then run your import again so that impdp can "create" the USERS tablespace from the dumpfile.
impdp SYSTEM/MYPASSWORD#orcl full=Y DIRECTORY=dir dumpfile=mydump.dmp LOGFILE=mydump.dmp.log transport_datafiles='/path/to/file'

Oracle 12 import - imp command

This is how my database was exported :
exp system/password#host owner=(ifs_owner,sis_owner,emu_owner) file=file1.dmp log=file1.log direct=Y
I am trying to import it using the following commands :
1) In Oracle Developer:
create user CLIENT_TEST identified by client_test_password;
grant connect, unlimited tablespace, resource to CLIENT_TEST;
2) Next, in command line:
imp system/sys FROMUSER=(ifs_owner,sis_owner,emu_owner) TOUSER=client_test file=e:\oradata\file1.dmp
This works up to a point, (some tables are imported, however it fails with the following mesages):
. importing IFS_OWNER's objects into CLIENT_TEST
. importing SIS_OWNER's objects into SIS_OWNER
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing EMU_OWNER's objects into EMU_OWNER
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing IFS_OWNER's objects into CLIENT_TEST
How can i solve the errors ?
Use parfile. I mean create a parfile for your imp command and write to line as:
fromuser=ifs_owner touser=CLIENT_TEST
fromuser=sis_owner touser=CLIENT_TEST
fromuser=emu_owner touser=CLIENT_TEST
imp system/sys parfile=parfilename file=e:\oradata\file1.dmp
You can use parfile to set oracle exp and imp parameters, all parameters like as fromuser,touser,file and ... . I mean you should write a parfile (using vi or other linux editor tools) in a directory for example /home/oracle with name par1 and put your parameters like below. for each user write a line:
fromuser=ifs_owner touser=CLIENT_TEST
fromuser=sis_owner touser=CLIENT_TEST
fromuser=emu_owner touser=CLIENT_TEST
and use of this parfile in imp command:
imp system/sys parfile=/home/oracle/par1 file=e:\oradata\file1.dmp

Import Postgres dump into a table with CockroachDB

After executing a pg_dump from PostgeSQL, I attempted to import the .sql file into CockroachDB, but received the following errors:
ERROR: unknown variable: "STATEMENT_TIMEOUT"
ERROR: unknown variable: "LOCK_TIMEOUT"
ERROR: unknown variable: "IDLE_IN_TRANSACTION_SESSION_TIMEOUT"
SET
SET
ERROR: unknown variable: "CHECK_FUNCTION_BODIES"
SET
ERROR: unknown variable: "ROW_SECURITY"
SET
ERROR: unknown variable: "DEFAULT_TABLESPACE"
ERROR: unknown variable: "DEFAULT_WITH_OIDS"
CREATE TABLE
ERROR: syntax error at or near "OWNER"
Any guidance?
CockroachDB has special support for using psql, which supports the COPY command (which is faster than batched INSERT statements).
You'll need to do two things:
Clean up the SQL file
Import it into CockroachDB (which sounds like you tried, but I'll include the steps here for anyone else who needs them):
Clean up the SQL File
After generating the .sql file, you need to perform a few editing steps before importing it:
Remove all statements from the file besides the CREATE TABLE and COPY statements.
Manually add the table's PRIMARY KEY constraint to the CREATE TABLE statement.
This has to be done manually because PostgreSQL attempts to add the primary key after creating the table, but CockroachDB requires the primary key be defined upon table creation.
Review any other constraints to ensure they're properly listed on the table.
Remove any unsupported elements, such as arrays.
Import Data
After reformatting the file, you can import it through psql:
$ psql -p [port] -h [node host] -d [database] -U [user] < [file name].sql
For reference, CockroachDB uses these defaults:
[port]: 26257
[user]: root

impdp does not accept two tables in an INCLUDE Command

When restoring a table from an oracle 11g backup, including more than 2 entries in the INCLUDE command returns syntax error.
The command that works is:
impdp SVC_DEMO/********* SCHEMAS=test REMAP_SCHEMA=test:SVC_DEMO REMAP_TABLESPACE=DATA:SYSTEM DIRECTORY=dmpdir DUMPFILE=devv2db_05102016.dmp TABLE_EXISTS_ACTION=replace INCLUDE = TABLE:"IN('TBLPARTNER')" LOGFILE=impschema1.log
Starting "SVC_DEMO"."SYS_IMPORT_SCHEMA_02": SVC_DEMO/********
SCHEMAS=test REMAP_SCHEMA=test:SVC_DEMO
REMAP_TABLESPACE=DATA:SYSTEM DIRECTORY=dmpdir DUMPFILE=devv2db_05102016.dmp
LOGFILE=impschema1.log
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SVC_DEMO"."TBLPARTNER" 21.46 KB 7 rows
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SVC_DEMO"."SYS_IMPORT_SCHEMA_02" successfully completed at 15:01:38
But, when I add a second table in the include command:
impdp SVC_DEMO/********* SCHEMAS=test REMAP_SCHEMA=test:SVC_DEMO REMAP_TABLESPACE=DATA:SYSTEM DIRECTORY=dmpdir DUMPFILE=devv2db_05102016.dmp TABLE_EXISTS_ACTION=replace INCLUDE = TABLE:"IN('TBLPARTNER', 'TBLACCOUNT')" LOGFILE=impschema1.log
I get the following message:
impdp SVC_DEMO/****** SCHEMAS=test REMAP_SCHEMA=test:SVC_DEMO
REMAP_TABLESPACE=DATA:SYSTEM DIRECTORY=dmpdir
DUMPFILE=devv2db_05102016.dmp TABLE_EXISTS_ACTION=replace INCLUDE =
TABLE:"IN('TBLPARTNER', 'TBLACCOUNT')" LOGFILE=impschema1.log
LRM-00116: syntax error at ')' following 'TBLACCOUNT'
I have looked for bugs in impdp but can't find one.
Am I doing something wrong?
Since you are running this on command line, depending on your OS, special characters may need to be escaped. (It's also easier to use a parameter file where you wont need to escape the characters)
include=TABLE:\"IN \(\'TABLE1\', \'TABLE2\'\)\"
Using a parameter file you just place one option per line and reference it with
impdp PARFILE=name.txt

Why do I get ORA-39001: invalid argument value when I try to impdp in Oracle 12c?

When I run this command in Oracle 12c SE2:
impdp system/Oracle_1#pdborcl directory=DATA_PUMP_DIR dumpfile=mydb.dmp nologfile=Y
I get this:
ORA-39001 : invalid argument value
ORA-39000 : bad dump file specification
ORA-39088 : directory name DATA_PUMP_DIR is invalid
We used to import this into 11g all the time.
How can I solve these errors?
From the 12c documentation:
Be aware of the following requirements when using Data Pump to move data into a CDB:
...
The default Data Pump directory object, DATA_PUMP_DIR, does not work with PDBs. You must define an explicit directory object within the PDB that you are exporting or importing.
You will need to define your own directory object in your PDB, which your user (system here) has read/write privileges against.
create directory my_data_pump_dir as 'C:\app\OracleHomeUser1\admin\orcl\dpdump';
grant read, write on directory my_data_pump_dir to system;
It can be the same operating system directory that DATA_PUMP_DIR points to, you just need a separate directory object. But I've used the path you said you'd prefer, from a comment on a previous question.
Then the import is modified to have:
... DIRECTORY=my_data_pump_dir DUMPFILE=mydb.dmp

Resources