Connect to database
sqlplus '/as sysdba'
Connect to remote Oracle server
sqlplus "sys/password@host/sid as sysdba"
Find versions
SQL> select * from v$version;
Prepare for patching
sqlplus '/as sysdba' -- Connect to DB
shutdown abort -- Kick all users off
startup restrict -- Restore any dangling transaction from above shutdown
shutdown immediate -- Clean shutdown
exit -- Disconnect from DB
emctl stop dbconsole -- Stop web console
lsnrctl stop -- Stop listener
/usr/sbin/lsof | grep $ORACLE_HOME -- Ensure there are no processes locking any files in $ORACLE_HOME
Patch Utility
Follow the instructions in the patch README for the required command-line options, but the patch utility is located at
$ORACLE_HOME/OPatch/opatch
Set terminal width
SET LINESIZE n
View scheduled jobs
DESCRIBE dba_jobs SELECT field1, field2, etc FROM dba_jobs
Change user password
alter user USERNAME identified by NEWPASSWORD;
Disable password expiration
ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED PASSWORD_LIFE_TIME UNLIMITED;
View user password expirations
select username, user_id, expiry_date, lock_date, account_status from dba_users;