Oracle 11g XE initialization on ubuntu 12.04 - oracle

I was following this tutorial:
http://sysadminnotebook.blogspot.com/2012/10/installing-oracle-11g-r2-express.html
and I sucessfully installed and started oracle database. Now I wanted to connect to that DB from bash, so I found that command:
sqlplus sys as sysdba
It asks for password, which in my case is oracle, and after I supply it, I get:
ORA-01031: insufficient privileges
What should I do?
EDIT:
I needed to add group dba and add myself to that group. However I've got other problem now. I wanted to create user, so I did:
CREATE USER myuser IDENTIFIED BY password
default tablespace users
temporary tablespace temp;
And I got: ORA-01034: ORACLE not available.
I tried: STARTUP But I got:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora'
I have '/u01/app/oracle/product/11.2.0/xe/dbs/init.ora' file but not initXE.ora

Is the o/s user a member of the dba group?

If this is a new installed Oracle and you do not have initXE.ora parameter file here /u01/app/oracle/product/11.2.0/xe/dbs/, that means you need to create XE DB first. To do that run /u01/app/oracle/product/11.2.0/xe/bin/createdb.sh script first.

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!!

Oracle 11g XE - Can't login and database is down

Just installed Oracle 11g XE (Windows), but can't connect in SQL Developer or run any command in CLI.
When try to connect in CLI using SYS or SYSTEM with password defined during the install, get the following error:
ORA-12638: credential retrieval failed
When I tray to connect via SQL Developer (tried via SID and Service Name, hostname=localhost, port=1521, SID=xe), get this error:
Status : Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Already tried change SQLNET.AUTHENTICATION_SERVICES = (NTS) to (NONE) in sqlnet.ora file. When I do this, get the following error when try to connect with the SYS or SYSTEM user and password:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Already tried every solution in Google results, like reinstall, stop and start services... Mostly ask for first connect in CLI to make some changes, but even this I can't accomplish.
Any suggestions on how connect to the database?
Found the solution:
I was installing in my company Windows user domain.
First uninstall any instance of Oracle XE 11g.
Switch to a local administrator Windows user and install Oracle XE 11g.
Sign off and back to company Windows user.
Edit the file C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora (or equivalent to your installation path). Change SQLNET.AUTHENTICATION_SERVICES = (TNS) to SQLNET.AUTHENTICATION_SERVICES = (NONE).
This change will allow you connect to database from you company Windows user.
As seen here: Error ORA-12638 in Oracle Database 11g
Try the following: Open command window, cd to Oracle bin directory, enter sqlplus /nolog. If you get a prompt enter connect / as sysdba. If you get connected then you can try "startup".
- -
Did you try to start the Oracle RDBMS service via Services (services.msc)?
Do you use an spfile? Check the registry for ORA_SID_NAME_PFILE that is different from default location of $ORACLE_HOME/dbs. Also check the default location. Use only the default location or the registry entry removing either the registry entry or the file in the default location depending on which you want to use.

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

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. :)

Oracle 11g can't log with sys user

Today i meet a werid thing:I can't log on remote server Oracle database with sys user!
The username/password is sys/123,and my colleage could!this situation maintained still now.
But i can log on with an normal user,not a system dba.This is no privilege limit.Why? It's so werid.
This error info:
ORA-01017:invalid username/password;logon denied.
The oracle version:11g.
Log on tool:PL/SQL
need other info?Is local install oracle 10g cause the problem?
On the command line:
SQL>show parameter remote_login_passwordfile The value is:EXCLUSIVE
Solved:This problem bother me 2 day.Now the problem has fixed in 3 steps:
1.login the remote server and login as sys/123 as sysdba.
2.reset the password ( alter user sys identified by 123;)
3.relogin the oracle use sys,done!

How to connect to newly installed Oracle XE instance?

I have installed Oracle XE on Win7 x64 machine. Installation completed successfully without problem, or perhaps installer didn't tell about them. But after installation I can't connect to database; its web interface is not working. I have looked through list of open ports, and there is no 8080 port as was noted during installation. Also I can't connect via SQLPlus.
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-12638: Credential retrieval failed
Somewhere in the web it was told to edit sqlnet.ora file, I have changed it in the following way:
# SQLNET.AUTHENTICATION_SERVICES = (NTS)
SQLNET.AUTHENTICATION_SERVICES = (NONE)
and now I get next error
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
What do I need to change so that I can connect to it?
I figured out the issue.
I was using domain login to install Oracle XE. If you are using domain login to install Oracle XE then the database creation will fail (though you may not get any error messages on that regard).
Solution:
Install Oracle using a local admin user.
Change SQLNET.AUTHENTICATION_SERVICES to (NONE) in sqlnet.ora.
Now login with your domain user to use oracle XE.
Check the Oracle services are started
Did you set your ORACLE_SID environment variable to the name of the instance you're connecting to?
Make sure oracle service is started.
did to ran netca after installation? - if not you can ran it from cmd
You can't connect using system if the instacne is down only as sysdba (user sys)
Make sure your ORACLE_HOME,ORACLE_SID,PATH environment variables are ok
If everything was ok then you can try to start/connect to the instance manually
Sample:
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>sqlplus "sys as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri May 11 16:21:42
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1375792 bytes
Variable Size 360710608 bytes
Database Buffers 167772160 bytes
Redo Buffers 5804032 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>select status from v$instance;
As Rejeev Divakaran said, installing oracle XE with local windows user, and switching back to domain user account, started db, able to connect.
Config
Office Laptop
Windows 7 64 Bit
Oracle 11g XE
Can you connect this way from the command line:
sqlplus / as sysdba
if so at the SQL prompt enter
SQL>startup
If the command returns ok then try to connect with a username and password.
This error message usually occurs when the database could not be started. The windows service may be running, but still Oracle might not be able to spawn server threads and hand out client connections.
Have a Look into app\oracle\admin\xe\bdump\alert_xe.log for any error messages during the last start of the Oracle service.
Just in case someone is as "lucky" as me: I recently couldn't install Oracle with a local user (as suggested here before) because the target machine (Win2k8 x64) was also the Domain Controller of that network.
All users were in domain - no local users available :(
Here are the steps I performed:
Installed Oracle XE in my local machine (that works fine). Made a backup (using the built-in backup.bat);
Transferred the fast_recovery_area folder to my target machine;
Installed the Oracle XE in the target machine normally;
Edited the %ORA_HOME%\network\admin\sqlnet.ora file and performed this well-known edit:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
Edited the %ORA_HOME%\bin\restore.bat file:
Replaced every entry rman target / (...) by rman target sys/MySysDbaPass (...)
Replaced every entry (...) connect / as sysdba^; by (...) connect sys/MySysDbaPass as sysdba^;
Runned restore.bat - when prompted, pointed to the fast_recovery_area I've transferred before.
Done! (pheew!)
Sorry for answering this YEARS old question, but I managed to make it work...
Make sqlnet.ora change.
Run StopDB.bat
Run MakeDB.bat
This will create a demo database, reset the password to 'oracle', and will also allow you to connect without error.

Resources