insufficient privileges SYS.DBMS_DDL - oracle

I am trying to use the Oracle imp utility. A lot of good documentation exists but it seems that it is not possible or documented how to import with a regular user. It is assumed that sys will be used I think. Grant privileges for example using something like
GRANT execute ON sys.dbms_ddl TO myuser;
Which is suggested on some non-Oracle sites. Does not work. The error remains the same.
IMP-00003: ORACLE error 1031 encountered
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_DDL", line 361
What grants should I issue to authorize a user for imp utility?
Importing as SYSTEM also does not work. This user also does not have permissions to import.
[vagrant#jira ~]$ imp SYSTEM/oracle#jira file=/tmp/jira-oracle.dmp fromuser=jira touser=jira_restore
Import: Release 12.2.0.1.0 - Production on Tue Oct 9 12:24:09 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Export file created by EXPORT:V12.02.00 via conventional path
import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
IMP-00003: ORACLE error 942 encountered
ORA-00942: table or view does not exist
IMP-00023: Import views not installed, please notify your DBA
IMP-00000: Import terminated unsuccessfully
Has anyone used these utilities with some success? I don't think they are officially supported by Oracle.
They are shipped by Oracle strange enough. On Oracle website
Instant client tools provides exp / imp utilities since v12.2.0.1.0.
Unrestricted download is available
But also on the documentation website of Oracle
Original export is desupported for general use as of Oracle Database
11g
So it seems it can be both: distribute tools but not support them!
So I am reaching a conclusion here. Simple export / import of a schema is not so simple if at all possible when using Oracle. Contrary to statements made.

Maybe the file you are trying to import constains objects that you have no permission to create/alter.
try this:
GRANT IMP_FULL_DATABASE TO myuser;
or run the IMP utility as SYSTEM user (not the SYS, but SYSTEM).

Related

Oracle XE 18c impdp dump from 19c

I have a dump file that is created using expdp from Oracle 19c (exported with version parameter 18). Is it even possible to import the dumpfile to an Oracle 18c XE database?
The structure and everything else from the 19c database is unknown to me. I just got the 13gb dumpfile.
While using impdp it says:
Connected to: Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
ORA-39002: invalid operation
Thats it.
In /opt/oracle/diag/rdbms/xe/XE/trace/alert_XE.log it says:
XEPDB1(3):DW00 started with pid=62, OS id=23288, wid=1, job SYSTEM.SYS_IMPORT_FULL_01
2020-12-09T15:25:55.364764+00:00
XEPDB1(3):Resize operation completed for file# 9, old size 266240K, new size 276480K
Is there a another logfile I don't know about?
Anyways, my command looks like this:
impdp user/password#localhost/xepdb1 DIRECTORY=import_dir DUMPFILE=dump.expdp nologfile=y version=18 full=y
Yes, the user is privileged to do so.
Yes, the import_dir is set with CREATE DIRECTORY and the user is also privileged to use this directory.
I'm lost.
edit: I used stackoverflow for many years now and this is my very first question since I'm NEW to oracle in general and as I stated above: I'm lost.
2nd edit:
It's still the same error even after I try to partially import the dump with parameters like tables=
Perhaps your dump file is too big. Oracle XE has some limitations.
See the Oracle documentation:
https://www.oracle.com/database/technologies/appdev/xe.html
Resources:
Up to 12 GB of user data
Up to 2 GB of database RAM
Up to 2 CPU threads
Up to 3 Pluggable Databases

how to connect oracle database from unix without showing password

i am trying to connect Oracle database from Linux server where environment variables and tnsnames.ora cannot be modified.
I am using following code to connect which is working fine and i am able to connect database using sqlplus.
export ORACLE_HOME=/opt/oracle/product/112030_cl_64/cl
export PATH=/opt/oracle/product/112030_cl_64/cl/bin:$PATH
sqlplus myuser/mypass#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(Host=x)(Port=x)))(CONNECT_DATA=(SERVICE_NAME=x)))
Now i am not able to find any solution how can i execute it so that i don't need to execute it manually every time and i don't want to share the password with anyone else. i want to connect db using sqlplus from a shell script to spool data.
any lead would be appreciable. Thanks in advance.
The cleanest way is to use Oracle Wallet to store database passwords and so that your scripts can use them.
Otherwise if you can login as the oracle product owner ("oracle" most of the time) and it belong to the "dba" group you can connect as sys without typing the password (sqlplus / as sysdba) but it's privileged access, don't use it for business processes.
Omit the password; you'll be prompted to enter it, but it'll be invisible (Windows example, but doesn't matter in this case):
M:\>sqlplus scott#orcl
SQL*Plus: Release 11.2.0.1.0 Production on ╚et Tra 11 13:01:35 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
That, of course, requires you to type it every time. If it is stored, somewhere, anyone else could see it. Perhaps there is a way, but I don't know it.

Failed to create view contains v$view

In sqlplus under normal schema account (not sys), query select * from v$instance; runs OK. But when create view which references it, error happens:
create or replace view vw_test_instance
as
select * from V$instance;
SQL Error: ORA-01031: insufficient privileges
If switch v$instance to any normal table like select * from dual;, then the view created with no problem.
Oracle version:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
The back ground is I'm upgrading a database run on 10g to 11g, things used to work on 10g just broken on 11g... Can I fix it without touching source code of views? Appreciated!
This is related to user GRANTS.
1. GRANT SELECT ON V$INSTANCE TO <USER>; --> Will be provided by SYSDBA
2. Then try. It will definitley help.
This link will also help you to understand why this kind of behaviour occurs.
v$views Grant
"query select * from v$instance; runs OK. But when create view which references it, error happens:"
The error you get - SQL Error: ORA-01031: insufficient privileges - indicates that your user lacks the privileges to create a view.
" things used to work on 10g just broken on 11g"
Clearly on 10g privileges your user had privileges to create views and on 11g they do not.
The most likely explanation is that your user relies on the CONNECT role. In older versions of Oracle this role had several system privileges, including CREATE VIEW. This implicit granting of privileges was always dodgy. However, in 11g this changed and the role now only has CREATE SESSION. All other privileges must be granted explicitly. This is mentioned in the 11g Upgrade docs and explained in depth by the 11g Security Guide Find out more.

Oracle 11g enterprise db to be imported into Oracle 11g express without error using imp

I have a database in Oracle, it has been made with the database "CMS" and with the username and password of "CMS" and "CMS".
The problem is its dump has been taken by Oracle 11g enterprise, i want to import it into Oracle 11g express for development purpose. I dont know how to do it if i use imp command and i want to import it into same CMS schema with the same username and password. I created an account CMS on it first, but when i try to import it into that user using imp command, it says no permission.
I am trying my best to explain the problem, but it is bit complex to explain. Please guide as i am very new in oracle.

IMPDP in Oracle 11g - From One Schema to other Schema

I used to run commands to get Oracle database backup in the old way using 'exp' and 'imp fromuser touser. Now, I am trying to user new command to take backup 'expdp' and 'impdp'.
Steps:
Got backup using expdp with schema parameter on the production server. my username is 'xxx' (Not sure it's fully exported with procedures, function, and view).
Now, on my dev server first I made another user called 'yyy'. I gave directory access to user 'yyy' and trying to run command impdp as below.
C:\impdp yyy/yyy remap_schema=xxx:yyy directory=abc dumpfile=123.dmp logfile=123.log
Now, I am getting an error like the below.
Import: Release 11.1.0.6.0 - Production on Thursday, 24 January, 2013 9:53:58
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining, and Real Application Testing options
ORA-31626: job does not exist
ORA-31633: unable to create master table "yyy.SYS_IMPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 978
ORA-01031: insufficient privileges
Do I miss any steps? like I have to create a job or anything, not sure. basically, I got backup from one user and need to restore on another user in Oracle.
Please help me.
User yyy will need appropriate privledges necessary to create the objects.
See: privileges required to import objects into your own schema.
http://docs.oracle.com/cd/E11882_01/server.112/e22490/original_import.htm#BABFHCBI
Also:
http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_overview.htm#CJAIBFJG
Many Data Pump Export and Import operations require the user to have the DATAPUMP_EXP_FULL_DATABASE role and/or the DATAPUMP_IMP_FULL_DATABASE role. These roles are automatically defined for Oracle databases when you run the standard scripts that are part of database creation. (Note that although the names of these roles contain the word FULL, these roles are actually required for all export and import modes, not only Full mode.)
The DATAPUMP_EXP_FULL_DATABASE role affects only export operations. The DATAPUMP_IMP_FULL_DATABASE role affects import operations and operations that use the Import SQLFILE parameter. These roles allow users performing exports and imports to do the following:
•Perform the operation outside the scope of their schema
I believe, import user donot have permission on import database directory.
In the Import db,
select directory_name,directory_path from dba_directories;
It will show the directory names
sql>grant read,write on directory abc to ;
Robertson
Oracle Database SME
+91-9886321339

Resources