Oracle not available error - oracle

After a long struggle of installing any Oracle XE on my windows XP I gave up and decided to create my database manually. The setup file provided by Oracle skips fast the Creation of Database services phase and completes. But OracleXEService does not get installed.
I've set evrything up, the directories, the service, Oracle_SID. All of them go normally. Then I connect to sqlplus, to an idle instance:
sqlplus /nolog
connect / as sysdba
then I type
spool create_script.log
and then finally when I enter
#C:\create_script.sql;
I get error stating Oracle is not available. I've checked the task manager, oracle.exe is there. I've restarted the OracleServiceXE. Nothing helps. Many say I should check if ORACLE_SID and ORACLE_HOME match. I wonder how should I know if they match or not?

You will need to post more information. What does your DB create script look like? Are you seeing any errors in the alert log or other logs on your server?
The ORACLE_HOME you specify for your service in your listener.ora file should match what your actual ORACLE_HOME path is set to.

Related

Data Pump export using cloud shell

I am trying to export schema using data pump on Oracle Cloud Autonomous database.
I am using cloud shell to export schema.
When I tried to do the final step:
expdp admin/password#DB_HIGH schemas=SCHEMA_NAME directory=data_pump_dir dumpfile=exp%U.dmp filesize=1G logfile=expot.log
I got
UDE-12154: operation generated ORACLE error 12154 ORA-12154:
TNS:could not resolve the connect identifier specified
Do I need Oracle instant client to do export?
The Oracle client code uses one of three ways to look up connect data:
A flat file named tnsnames.ora
Oracle Names service
LDAP
When the complete ORA-12154 error appears with the text line, your program has found a working Oracle client install. However, the specified Oracle service is not listed in tnsnames.ora, Oracle Names or LDAP.
The first step in the troubleshooting process is to determine which name resolution method is deployed at your site. Most sites use tnsnames.ora, but enough use Oracle Names and LDAP, so it’s best to confirm this information.
If you are not the database administrator, get in touch with the people managing your Oracle systems and find out which method you should be using. They may be able to guide you in fixing the problem in accordance with your site’s standards.
The client code decides which mechanism to use based on the file sqlnet.ora. This file and tnsnames can usually both be found in the Oracle install directory (“ORACLE_HOME”), under network/admin/. This location may be overridden with the environment variable TNS_ADMIN.
If the sqlnet.ora file does not exist or does not specify a resolution method, then Oracle Net uses tnsnames.ora.
Example locations of Oracle networking files include:
Windows
ORANTNET80ADMIN
ORACLEORA81NETWORKADMIN
ORAWIN95NETWORKADMIN
ORAWINNETWORKADMIN
UNIX / Linux
$ORACLE_HOME/network/admin/
/etc/
/var/opt/oracle/
If you fix the naming issues, but you still see the ORA-12154 error, check the Oracle service to confirm that it’s available for connections. A power outage, server failure, or network connectivity issue will make this resource inaccessible. It’s also possible that scheduled maintenance or repairs of an unrelated Oracle issue may take that resource temporarily offline.
Thanks

Error ORA-12162: TNS:net service name is incorrectly specified on Ubuntu 18.04 after installing sqlplus

This is the first time I interact with a database or with sqlplus, but I'm coursing a subject called Data Bases in my college and we were told to install sqlplus with no further assistance and "to type sqlplus with the user SYS and the password we choosed during the installation", so I followed the described procedure to install it in my Ubuntu 18.04 computer in the upvoted question here https://askubuntu.com/questions/159939/how-to-install-sqlplus and everything worked out fine, except that I wasn't asked to write a password, and when I tried the instruction my professor gave me (to type sqlplus with the user SYS) I get the error ORA-12162: TNS:net service name is incorrectly specified.
After a long time reading, I jumped into the conclusion that I should export my SID, and I exported the one described here: http://www.dba-oracle.com/t_ora_12162_tns_net_service_name.htm
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
but that didn't work either, and I read I should export my SIDE, which I tried to find by writing
sqlplus \nolog
SELECT instance FROM v$thread;
but then I get SP2-0640: Not connected, so I don't really get what I'm suppose to do when my professor asks us to type sqlplus (I think is to connect with my own database that I installed when I installed sqlplus, but I'm not sure) and why is not working.
When I exposed the whole problem to my professor he extended the assignment due time in one day, but just that.
There are a couple of things wrong with this scenario:
sqlplus is only a client tool, not the database itself. Either your professor should have provided you with network access to a pre-configured database, along with instructions on how to configure the client tnsnames.ora and sqlnet.ora files, or they should have been more specific and told you to install Oracle Database locally on your system and not just sqlplus.
Oracle products are not supported on Ubuntu (no matter what anyone says about hacking the install to work). You must use Red Hat, Oracle Linux, or SuSE if you want to get expected results.
If you can get Oracle Database installed on a supported operating system, you will have the option to create your first database at the end of the install. Once that is done, your procedure to export ORACLE_HOME and ORACLE_SID is mostly correct. Exact values for ORACLE_HOME and ORACLE_SID should be set during the installation and database creation.
export ORACLE_HOME=/u01/oracle/product/db_1
export ORACLE_SID=orcl
sqlplus /nolog
SQL> connect sys as sysdba
OR
SQL> connect / as sysdba

sqlplus ORA-12504 running sqlplus locally on oracle server host - but only as non oracle owner account

On various UX environments I run some shellscripts to gather software version info and push it back to a central server. One script does this for Oracle.
On a 12.1.0.2.0 Oracle server (Solaris 11.2 system), the oracle owner account can sqlplus into the local Oracle service, after running oraenv with ORACLE_SID set & ORAENV_ASK=no
Either of these syntaxes works:
sqlplus oracle_ID/password
sqlplus oracle_ID/password#ORACLE_SID
However a non oracle owner account can only use the
sqlplus user_ID/password syntax to connect to the local oracle service!
sqlplus 'user_ID/password#"//hostname:1521/ORACLE_SID"' - syntax also works perfectly.
Attempting to use the following syntax is broken - the first is the one of interest (& works across all other Oracle database hosts for all instances):
sqlplus user_ID/password#ORACLE_SID - ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
sqlplus user_ID/password#"/ORACLE_SID" - ORA-12154: TNS:could not resolve the connect identifier specified
tnsping ORACLE_SID connects with the service OK.
ohost:~$ truss sqlplus user_ID/password#ORACLE_SID
truss: cannot trace set-id or unreadable object file: /apps/oracle/product/12.1.0.2/bin/sqlplus
It would be best to have one consistent syntax across all my servers for the data gathering script and I was curious why the change of UNIX id would cause this anomaly. Any ideas or ideas how to debug? Thx A.
Update: 15-Apr-2020 - After more GoogFu answer lies in which 'adapter' the user account uses to resolve the 'alias'.
oracle owner uses 'TNSNAMES' adapter whereas monitor account uses 'HOSTNAME' and the HOSTNAME method sends a null SERVICE_NAME field in the CONNECT_DATA. I haven't spotted why the oracle owner uses the TNSNAMES method, yet. I've looked through shell environment variables for both UNIX id's and the oraenv sets up all the ones that refer to the ORACLE_HOME okay. Can't see anything specifically TNS or 'net' related...
Easy when you know how. Seems a little weird to answer my own question...
Simply, the tnsnames.ora file was not world (other) readable. Hence non dba-group accounts had to fall back to the HOSTNAME resolution method.
That was a merry waste of 4 hours. It's not the first time an Oracle installation has had over(?) zealous permissions set on a config or shared object file, inside a 'server' installation, that a genuine client process requires. I haven't looked specifically but it doesn't seem to be filed as a bug with Oracle.

Able to connect through CMD but not to Oracle SQL developer to Oracle DB

So I got connected to Oracle 11g in cmd as follows
However, when I type the same username and password in Oracle SQL Developer, it does not work. And I have uname and pwd, what goes in the connection name?
This what I got, when i entered a connection name and My uname and PWD
Oracle SQL Developer
Just give any string in your connection name, that is used for identify different connection in sql developer.
Like,
Connection name : Connection_1
username : system
password : yourpass
If you want to create another connection to another database or another schema then you have to give another name and by login you can directly access that particular schema.
Hope it will help.
I think the issue might be that SQL Developer uses a different tnsnames.ora file. The file can be set under:
Tools>Preferences>Database>Advanced
Choose the correct tnsnames directory there.
Depending on your developer version, you might also want to set the Oracle Client folder.
After that in your connection dialog choose TNS instead of BASIC. And pick the tnsalias name from the list from the file.
Let me know if that works.
I also faced the same issue and after trying series of steps came to this conclusion.
1)Make sure to follow the blog to install the DB and check the validation steps too :
https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
This blog makes sure that you are able to connect to SQL via CMD.
2) If you still face issue while connecting to SQL developer for the same configuration,check : Advanced system settings-->Environment variables-->system variables--> PATH
Make sure you have entry for the DB here.
Environment variable for DB
3) If above step is a success,check the tnsnames.ora and listener.ora files present in the location : dbhome_1\network\admin
These files should have a valid entry for the localhost and SID/service name.
Thanks,
Sandeep

Oracle XE 11g (windows 8) I can't connect to the Database (idle instance)

Hi I have problem with idle instance
When I trying:
sqlplus / as sysdba
I get result: Connected to an idle instance.
And when I try startup I get:
ORA-01078: failure in processing system parameters
ORA-01565 error in identifying file 'C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora
ORA-27041: unable to open file
ORA-04002: unable to open file
O/S-Error: (OS 2) File not found;
My system is Windows 8. Do you any idea how to solve it?
SOLUTION:
I have to startup using command:
startup pfile='<path to file>/init.ora'
and change all paths in init.ora where was
<ORACLE_BASE>
Thx for help
I've got that pain too.
To install Oracle XE you should login as local admin - NOT domain account.
This https://community.oracle.com/thread/2361291 made me happy :)
I just had the same problem.
You just have to start the setup to install the database as administrator.
After this and a reboot everything works fine.
I highly recommend reading the Oracle® Database 2 Day DBA manual, or hire a dba.
You are missing the init{ORACLE_SID}.ora, the parameter file which contains things like database name, controlfile locations. the init{ORACLE_SID}.ora is a text file that is edited with a regular text editor. This file can be converted to a spfile{ORACLE_SID}.ora that can be edited using a database instance. This is also a dynamic parameter file meaning that when you change parameters in an instance, the parameters can also be recorded in the spfile for later reuse.
For now add the db_name and control_files. Make sure that the contol_files parameter points to an existing controlfile[s]. If there are no existing control_file[s], just trash the initXE.ora, spfileXE.ora and start dbca, the Database Configuration Assistant and using that create a new database.

Resources