Friday, April 10, 2009

Changing forgotten password in Oracle

If you log in as a user with the ORA_DBA group, you will be able to get into your instance without a password. Usually the user on your machine that installed Oracle will work.

Just do this at a command prompt (after setting ORACLE_HOME and ORACLE_SID)

sqlplus "/ as sysdba"

Once you've done that, you can "alter user sys identified by xxxxx" to change the SYS password (replace xxxxx with the new one) .

Faced the problem listener was not starting because it did not have access to the log file for writing.

Exported the following variable at command line
$ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
$ LSNR=$ORACLE_HOME/bin/lsnrctl
$ SQLPLUS=$ORACLE_HOME/bin/sqlplus
$ export ORACLE_HOME
$ export PATH=$ORACLE_HOME/bin:$PATH
$ /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/lsnrctl status

TNS:net service name is incorrectly specified
Went to ORACLE_HOME above /network.admin/tnsnames.ora to find out the settings.

jdbc:oracle:thin:[user/password]@[host][:port]:SID
jdbc:oracle:thin:[user/password]@//[host][:port]/SID

user - The login user name defined in the Oracle server.

password - The password for the login user.

host - The host name where Oracle server is running.
Default is 127.0.0.1 - the IP address of localhost.

port - The port number where Oracle is listening for connection.
Default is 1521.

SID - System ID of the Oracle server database instance.
SID is a required value. By default, Oracle Database 10g Express
Edition creates one database instance called XE.

No comments: