Error while restoring oracle 10g .dmp file in oracle database 12c - oracle

I've got a .dmp file created with Oracle 10g containing the database of one of my clients. I can't for the life of me get it set up with my 12c installation. I can connect to my db using https://localhost:5500/em
I've created a user 'BOB' in my desired PDB and granted import, read and write permissions. Next I try to import using the following command:
impdp BOB/password#//localhost:1521/pdbname full=y directory=dpdump_dir dumpfile=BOB.dmp
However this gives me the following errors:
UDI-12541: operation generated ORACLE error 12541
ORA-12541: TNS:listener does not currently know of service requested in connect descriptor
In the listener.ora and tnsnames.ora i have EZCONNECTOR and ports 1521. Does anyone know how to get this to work?
Many thanks in advance,
Bob

First ensure that you can do tnsping for pdbname to ensure db connect :- $ tnsping bdbname
If you get details of connection string by tnsping, you can try command with following format:
impdp bob/password#127.0.0.1:1521/pdbname directory=dpdump_dir dumpfile=BOB.dmp
I have removed "full=y" as it's not required if you are not restoring full database, specially it used apply with imp/exp utility.
You should remember that pdbname is being specified as a dbname/service_name in your example. You can confirm service_name by following command:
$ lsnrctl services; /* You can get service name and put it on your impdp command. */
In addition, you can try without specifying ip,port and dbname as you are working in localhost itself:
$ impdp bob/password directory=dpdump_dir dumpfile=BOB.dmp

First of all, you should check the connection
sqlplus> BOB/password#localhost:1521/pdbname
If you cannot connect, please connect with sys / as sysdba
Then using command:
SQL> alter session set container=pdbname
SQL> alter pluggable database pdbname open
Then quit and try to your command again. :)

Related

Oracle XE 18c rename SID [duplicate]

I needed to change the SID of an Oracle XE database (not the Service Name) to match a production database.
When I tried searching online, most of the pages were describing changing or adding a service name through tnsnames.ora; that's not what I needed to do.
The asktom article has the answer, but the formatting and verbosity makes it hard to follow, so here's a summary:
[XE_HOME] means where Oracle XE is installed. Normally this is C:\oraclexe\app\oracle\product\10.2.0\server.
Make sure you have Administrator privileges or the procedure will fail.
Configure the SPFILE (you can remove the old file if you want)
copy [XE_HOME]\dbs\spfileXE.ora [XE_HOME]\dbs\spfileNEW_SID_NAME.ora
copy [XE_HOME]\database\initXE.ora [XE_HOME]\database\initNEW_SID_NAME.ora
Edit [XE_HOME]\database\initNEW_SID_NAME.ora: It should contain a single line like this: SPFILE='[XE_HOME]\server\dbs/spfileNEW_SID_NAME.ora'
Shutdown and replace the old service with a new:
sqlplus / as sysdba and execute shutdown
lsnrctl stop
oradim -new -sid NEW_SID_NAME -startmode auto -pfile [XE_HOME]\database\initNEW_SID_NAME.ora
oradim -delete -sid XE
lsnrctl start
Update the ORACLE_SID environment property (System Settings > Advanced > Environment)
Force Oracle to register with listener
sqlplus / as sysdba and execute alter system register;
You can verify that the SID was changed by executing the following query: select instance_name from v$instance;
I had some problems with the solution posted by Johannes, so I had to do some extra steps.
When trying to connect to oracle (step 4) by doing sqlplus / as sysdba I got:
ERROR: ORA-12560: TNS:protocol adapter error
The solution for this was executing the following line:
oradim -start -sid NEW_SID_NAME
Then connecting with / worked fine, but trying to connect to NEW_SID_NAME with system or HR got me another problem:
ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I checked that with the query select instance_name from v$instance; that the listener would be NEW_SID_NAME, and so did. But running lsnrctl status in the command line or querying select name from dba_services; didn't show NEW_SID_NAME as a listener.
The solution of this problem was executing the followind sentence on sqlplus:
alter system set service_names='NEW_SID_NAME';
Maybe you'll need to execute alter system register; after this also.
After doing this two steps I can connect to the NEW_SID_NAME with system and HR.
Hope it helps
In version 11g, all of the previous solution didn't work... I always get the following error when trying to do the sqlplus / as sysdba :
ERROR: ORA-12560: TNS:protocol adapter error
Luckily I found a script to do what I wanted to do under [XE_HOME]\config\scripts. The script is named XE.bat and it will instantiate a new database from scratch asking you for the sysPassword along the process. So what I did was :
Stop and remove the existing service if any:
oradim -delete -sid XE
Stop the listener
Configure the SPFILE as explained by Johannes
Make a copy of the script XE.bat, you can name it whatever you want
Edit the copy of the script as follows :
Change line "set ORACLE_SID=XE" to "set ORACLE_SID=NEW_SID_NAME"
Change wherever you see "-sid XE" to "-sid NEW_SID_NAME"
Update the line where it calls the "orapwd.exe" command to point to a file called PWDNEW_SID_NAME.ora instead of PWDXE.ora
Update the line that echos the spfileXE.ora into the initXE.ora to echo spfileNEW_SID_NAME.ora into initNEW_SID_NAME.ora (this part may render the step 3 useless but I prefer to do it anyway, just in case...)
Execute the script... It will prompt you for the SYSTEM password a few times saying
Enter value for 1:
or
Enter value for 2:
That's it, the new database with your NEW_SID_NAME is up and running!!

ORA-12514 TNS:listener does not currently know of service requested in connect descriptor in oracle 11g

Already read all the question related to this error, but couldnt resolve the issue.
As of yesterday, the oracle SMALLWORLD service has stopped working and the error is
ORA-12514 TNS:listener does not currently know of service requested in connect descriptor
the following are the system information to better understand the situation:
LISTENER.ORA content :Listener.ora
TNSNAMES.ORA content :TNSNAMES.ORA
SQLNET.ORA content :SQLNET.ORA CONTENT
the following is the result of
LSNRCTL SERVICES
command.
LSNRCTL.SERVICES result
as you can see the service name ATTACHMENTDB is recognisable, but service SMALLWORLD is not.
while trying to logon with sysdba, the result is
ORA-01017 invalid user name/password; logon denied
while trying to logon with SYSTEM user, the result is
ORA-01034 : ORACLE not available
and
ORA-27101 : shared memory realm does not exist
below image, is the result of SQLPLUS /NOLOG command
SQLPLUS /NOLOG
i already tried stopping and starting the ORACLE services and the Listener in the SERVICES.MSC, but nothing worked.
i don't understand why ATTACHMENTDB service works but not the SMALLWORLD service.
any hint appreciated.
I have this problem in windows 10 and Oracle19C.
You should try the following ways and one of them may work for you.
Way-1: In windows: use this video: restart services OracleOraDB19Home1TNSListener then OracleServiceORCL.
Way-2: connect with system user password to sql plus as shown as:
Enter user-name: system/ as sysdba
Enter password: your_password
SQL> shutdown
SQL> startup nomount
SQL> alter system set db_recovery_file_dest_size=4G scope=both;
SQL> alter database mount;
SQL> alter database open;
And now check your problem fixed? If no set below code then check again.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=127.0.0.1) (PORT=1521)))';
This work for me.

Running SQL file in command line using sqlplus result with an error

Using ORACLE 12.0c and SQL Developer.
I try to run a SQL file (myfile.sql) in command line using sqlplus:
sqlplus username/password#schema #myfile.sql resulted with an error.
I run only sqlplus with connection parameters sqlplus username/password#schema and still receive an error (see screenshot).
Typing the username and password didn't help as well.
Only running sqlplus and supply the database domain, port and database name I managed to connect and run the file.
The database is defined in SQL Developer, but I don't see it in TNSNames.ora.
What am I missing?
I give credit to #thatjeffsmith and the answer is... see screenshot:

How to find Oracle database connection details

I am new to Oracle DB and have created a new Oracle 12c database. I am creating a new connection through SQLDeveloper and where can I get the connection details? HostName? Port? SID?
I tried connecting using default details given in documentation but got the below error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor>
You really need to give more info if you need help :)
What Server are you using? Linux? Windows?
Post your oratab file (/etc/oratab)
Post your TNS file ($ORACLE_HOME/network/admin/tnsnames.ora)
Post your Listener file ($ORACLE_HOME/network/admin/listener.ora)
Assuming you're using Linux :D
You need to look at the file "/etc/oratab" if you're on Linux.
This will contain your SID.
Your TNS (located in $ORACLE_HOME/network/admin/) should contain the TNS Entry with SID as per your oratab file.
This is an example entry you will find in the oratab file:
orcl:/opt/oracle/product/10.2.0/db_1:Y
The let hand side "orcl" is your SID, and you will use this for your SID in the Oracle TNS.
If you find that your TNS is configured correctly, then the error message you provided may also indicate that your Database was not registered to the Listener.
You may connect to the sql database as follows:
Set your Oracle Environment
$ . oraenv
Prompts for SID: Enter the value "orcl" (if this is your SID?)
now login:
$ sqlplus / as sysdba
This will log you into oracle as a sysdba.
Execute the follwing:
SQL> Alter System Register;
You should notice a confirmation message that the system is altered.
now exit SQLplus, and try again
SQL> exit
On Windows ISTR, to get the SID, look at the running processes and you should see something called "oracleXXX.exe" or similar. The XXX will be your SID.
You should also see a "TNS" or "Listener" process, probably with the same "XXX".
To get the port number, (usually 1521-1526), find the folder where Oracle was installed to "the "Oracle Home") and in there go to the "network\admin" folder. You should see a "listener.ora" file in there, and if you view this is notepad you should be able to figure out what the port is set to.
This file should also tell you what host/network address the listener is attaching to - you use this IP as the "Hostname" in you connection. Sometimes (again I'm a bit cloudy with Oracle on Windows) the listener.ora might be named listnereXXX.ora, with XXX matching the value you will have seen in SID the checks above.
Obviously if you are new to Oracle, do not amend these files.
If you have netstat/wireshark or similar you can see what the port is attached to the TNS/Listener process.
If you have installed it on same machine on which you are running sql-developer then
host: 127.0.0.1
port: 1521
username and password same as you put while installing oracle datatabse.
keep sid blank

How can I change the SID of an Oracle XE instance

I needed to change the SID of an Oracle XE database (not the Service Name) to match a production database.
When I tried searching online, most of the pages were describing changing or adding a service name through tnsnames.ora; that's not what I needed to do.
The asktom article has the answer, but the formatting and verbosity makes it hard to follow, so here's a summary:
[XE_HOME] means where Oracle XE is installed. Normally this is C:\oraclexe\app\oracle\product\10.2.0\server.
Make sure you have Administrator privileges or the procedure will fail.
Configure the SPFILE (you can remove the old file if you want)
copy [XE_HOME]\dbs\spfileXE.ora [XE_HOME]\dbs\spfileNEW_SID_NAME.ora
copy [XE_HOME]\database\initXE.ora [XE_HOME]\database\initNEW_SID_NAME.ora
Edit [XE_HOME]\database\initNEW_SID_NAME.ora: It should contain a single line like this: SPFILE='[XE_HOME]\server\dbs/spfileNEW_SID_NAME.ora'
Shutdown and replace the old service with a new:
sqlplus / as sysdba and execute shutdown
lsnrctl stop
oradim -new -sid NEW_SID_NAME -startmode auto -pfile [XE_HOME]\database\initNEW_SID_NAME.ora
oradim -delete -sid XE
lsnrctl start
Update the ORACLE_SID environment property (System Settings > Advanced > Environment)
Force Oracle to register with listener
sqlplus / as sysdba and execute alter system register;
You can verify that the SID was changed by executing the following query: select instance_name from v$instance;
I had some problems with the solution posted by Johannes, so I had to do some extra steps.
When trying to connect to oracle (step 4) by doing sqlplus / as sysdba I got:
ERROR: ORA-12560: TNS:protocol adapter error
The solution for this was executing the following line:
oradim -start -sid NEW_SID_NAME
Then connecting with / worked fine, but trying to connect to NEW_SID_NAME with system or HR got me another problem:
ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I checked that with the query select instance_name from v$instance; that the listener would be NEW_SID_NAME, and so did. But running lsnrctl status in the command line or querying select name from dba_services; didn't show NEW_SID_NAME as a listener.
The solution of this problem was executing the followind sentence on sqlplus:
alter system set service_names='NEW_SID_NAME';
Maybe you'll need to execute alter system register; after this also.
After doing this two steps I can connect to the NEW_SID_NAME with system and HR.
Hope it helps
In version 11g, all of the previous solution didn't work... I always get the following error when trying to do the sqlplus / as sysdba :
ERROR: ORA-12560: TNS:protocol adapter error
Luckily I found a script to do what I wanted to do under [XE_HOME]\config\scripts. The script is named XE.bat and it will instantiate a new database from scratch asking you for the sysPassword along the process. So what I did was :
Stop and remove the existing service if any:
oradim -delete -sid XE
Stop the listener
Configure the SPFILE as explained by Johannes
Make a copy of the script XE.bat, you can name it whatever you want
Edit the copy of the script as follows :
Change line "set ORACLE_SID=XE" to "set ORACLE_SID=NEW_SID_NAME"
Change wherever you see "-sid XE" to "-sid NEW_SID_NAME"
Update the line where it calls the "orapwd.exe" command to point to a file called PWDNEW_SID_NAME.ora instead of PWDXE.ora
Update the line that echos the spfileXE.ora into the initXE.ora to echo spfileNEW_SID_NAME.ora into initNEW_SID_NAME.ora (this part may render the step 3 useless but I prefer to do it anyway, just in case...)
Execute the script... It will prompt you for the SYSTEM password a few times saying
Enter value for 1:
or
Enter value for 2:
That's it, the new database with your NEW_SID_NAME is up and running!!

Resources