Manage RAC Oracle Database Server using SRVCTL
$ srvctl status database -d ORCL
$ srvctl stop database -d ORCL -o abort
$ srvctl stop asm -i ASM -o abort
$ srvctl start database -d ORCL
$ srvctl stop | start | status | restart database -d ORCL
Check if instance is running
$ ps -ef |grep [s]mon
$ srvctl status database -d ORCL
Check and Set Oracle Environment
To check or set Environment: Go to ORACLE DBA / General / Environment...
Stop/ Start
$ srvctl stop database -d ORCL
$ srvctl start database -d ORCL
$ service dbora.service stop | start | restart | status
$ systemctl start | enable | status dbora.service
Win: net stop OracleServiceORCL
Win: net start OracleServiceORCL
SQL> startup nomount
SQL> alter database mount;
SQL> alter database open;
SQL> startup mount
SQL> alter database open;
SQL> startup force mount
SQL> alter database open;
Read only DB mode
SQL> SELECT OPEN_MODE FROM V$DATABASE;
SQL> ALTER DATABASE OPEN READ ONLY;
Read or read write DB mode
SQL> SELECT open_mode FROM v$database;
SQL> ALTER DATABASE OPEN READ WRITE;
Restricted mode
SQL> SELECT logins from v$instance; -- Check if database in restricted mode
SQL>
SELECT b.grantee, a.grantee || ‘ (Role)’ AS granted
FROM dba_sys_privs a, dba_role_privs b
WHERE a.privilege = ‘RESTRICTED SESSION’
AND a.grantee = b.granted_role
UNION
SELECT b.username, ‘User (Direct)’ — find users who have given access not through role
FROM dba_sys_privs a, dba_users b
WHERE a.privilege = ‘RESTRICTED SESSION’
AND a.grantee = b.username;
GRANTEE GRANTED
———— ————————————-
SCOTT User (Direct)
SYS DBA (Role)
SYSTEM DBA (Role)
SQL> GRANT RESTRICTED SESSION TO SCOTT;
SQL> REVOKE RESTRICTED SESSION FROM SCOTT;
SQL> SHU IMMEDIATE
Opening a database in restricted mode allows database access only to users with both the CREATE SESSION and RESTRICTED SESSION system privilege; only database administrators should have the RESTRICTED SESSION system privilege
SQL> STARTUP RESTRICT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
Find and disconnect users connected during restricted session. Any users connected to the database when restricted session is enabled will remain connected and need to be manually disconnected
SQL> SELECT username, logon_time, process from v$session;
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;
ORACLE Enterprise Manager (OEM) Cloud Control 12c
Start
/u01/app/oracle/agent12c/core/12.1.0.3.0/bin/emctl start oms
Stop OMS
$ emctl stop oms -all
Or use hard stop, Kill -9 all WebLogic and OMS processes still running after the stop. You can find these processes, using ps:
ps -ef | grep EMGC_ADMINSERVER
ps -ef | grep EMGC_OMS1
ps -ef | grep oms
Delete every .lok file you find under WebLogic Domain
find . -name "*.lok"
These files were:
../gc_inst/user_projects/domains/GCDomain/config/config.lok
../gc_inst/user_projects/domains/GCDomain/servers/EMGC_OMS1/data/ldap/ldapfiles/EmbeddedLDAP.lok
../gc_inst/user_projects/domains/GCDomain/servers/EMGC_OMS1/tmp/EMGC_OMS1.lok
../gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/data/ldap/ldapfiles/EmbeddedLDAP.lok
../gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/tmp/EMGC_ADMINSERVER.lok