Instance Management
Monitor
Start monitoring:
$ NETSTAT-TLNP | grep 1521
$ lsnrctl
Lsnrctl> Help
$ LSNRCTL Status
$ lsnrctl Stop
$ netstat-tln | grep 1521
Fast Dynamic registration: (optional)
$ sqlplus/as SYSDBA
Sql> alter system register;
$ LSNRCTL Status
em
Start em:
$ NETSTAT-TLNP | grep 1158
$ echo $ORACLE _sid
Orcl
$ echo $ORACLE _unqname
Orcl
If Oracle_unqname is not set:
$ Export ORACLE_UNQNAME=ORCL
Or
$ VI. bash_profile
Export ORACLE_UNQNAME=ORCL
$ . . bash_profile
Ensure that the hostname resolves correctly:
$ cat/etc/hosts
$ EMCTL Status Dbconsole
$ emctl Stop Dbconsole
$ emctl Start Dbconsole
To view the OEM ports:
$ find/u01-name Portlist.ini
Reconfigure EM:
$ EMCA
$ emca-deconfig Dbcontrol db Erase
$ emca-config Dbcontrol db reconfiguration
To launch an instance:
$ ls $ORACLE _home/dbs/spfileorcl.ora
sql> shutdown Immediate
sql> startup Nomount initialization
Sql> select status from V$instance; View Instances can query in-memory information
Sql> select * from V$sgainfo;
Sql> select * from Hr.employees;
Sql> Conn Hr/hr
Sql> startup mount or ALTER DATABASE mount; to the nomount stage with
Sql> Show Parameter Control_files
Sql> select status from V$instance;
Sql> select * from V$controlfile;
Sql> select name from V$datafile; Dynamic View It's all from the control file . because the database has not been opened (data file)
Sql> select * from Hr.employees;
Sql> Conn Hr/hr
sql> startup or ALTER DATABASE open; according to the control file record Locate data files individually
Sql> select status from V$instance;
Sql> select * from Hr.employees;
Sql> Conn Hr/hr
To close the database:
sql> shutdown normal does not connect new users wait for the current session not to be actively closed
sql> shutdown Transactional does not connect to new users and so on the active shutdown session transactional shutdown without running
sql> shutdown immediate immediate closure
sql> Shutdown Abort
Control script:
$ vi/etc/oratab
$ VI $ORACLE _home/bin/dbstart
$ VI $ORACLE _home/bin/dbshut
To restart the database:
sql> Startup force
Startup force = Shutdown Abort + startup
Startup force mount = Shutdown Abort + startup mount
Practice:
Familiarize yourself with the start-up and shutdown of 3 services
parameter Management
Parameter file:
$ ls $ORACLE _home/dbs/spfileorcl.ora
Pre-Backup:
$ CP Spfileorcl.ora Spfileorcl.ora.bak
Can not be directly modified by VI!
View parameters:
Sql> Show parameter
Sql> Select NAME, VALUE from V$parameter;
Modify Parameters:
Dynamic Parameters: Immediate effect
$ strings $ORACLE _home/dbs/spfileorcl.ora|grep Resource_limit
Sql> Show Parameter Resource_limit
Sql> alter system set resource_limit=true;
Sql> Show Parameter Resource_limit
$ strings $ORACLE _home/dbs/spfileorcl.ora|grep Resource_limit
current memory value changed Write a parameter file
static dynamics are system modifications.
Static parameters: Restart to take effect
$ strings $ORACLE _home/dbs/spfileorcl.ora|grep processes
*.processes=150
Sql> Show parameter processes value is 150
Sql> alter system set PROCESSES=300 scope=spfile; Change files only
Sql> Show parameter processes value is 150
$ cat $ORACLE _home/dbs/spfileorcl.ora
*.processes=300
Restart the database, the static parameter modification takes effect:
sql> shutdown Immediate
Sql> Startup
Sql> Show parameter processes value is 300
Dynamic
Session level Modify Parameters:
Sql> select Sysdate from dual;
Sql> alter session set nls_date_format= ' Dd-mon RR ';
Sql> select Sysdate from dual; Affects the current session only and does not affect the system
Sql> Conn/as SYSDBA
Sql> select Sysdate from dual; Restore default Settings
Pfile/spfile Format conversion:
sql> create pfile= '/home/oracle/initorcl.ora ' from SPFile;
$ cat/home/oracle/initorcl.ora
$ mv $ORACLE _home/dbs/spfileorcl.ora $ORACLE _home/dbs/spfileorcl.ora.bak
sql> shutdown Immediate
sql> Create spfile from pfile= '/home/oracle/initorcl.ora '; Binary Convert a text file into binary
$ Strings $ORACLE _home/dbs/spfileorcl.ora
Specify a parameter file to start the database:
sql> startup pfile= '/home/oracle/initorcl.ora '
Practice:
Modify the Resource_limit and processes parameters. and find the corresponding information in alert log.
dump files for warning logs and background processes
$ find/u01-name Alert_*.log
$ vi/u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log
Sql> Show parameter Dump
Oracle Classroom Essay--Day 16th