Oracle automatically starts database instances in many ways. The following describes the two most common methods for oracle to automatically start multiple data instances.
An existing machine requires oracle to automatically start multiple data instances, such as DB1 and DB2
Method 1:
- export ORACLE_SID=DB1
- sqlplus ‘/as sysdba' <<!
- startup
- exit
- !
-
- export ORACLE_SID=DB2
- sqlplus ‘/as sysdba' <<!
- startup
- exit
- !
For different listening ports, the method for starting the listening port is lsnctl start listener1/linsterner2/
About listener? You can view the configuration file through lsnctl status, and then edit it.
If the port is the same, you only need to start lsnctl start.
You can change SID startup for web configuration startup.
- export ORACLE_SID=DB1
- emctl start dbconsole
Method 2: automatically start an oracle data instance at startup)
Modify the/etc/oratab file and change N to Y after the name of the instance to be started.
: G/N/s // Y/g change all N to Y
Then write a shell script.
- cd /etc/init.d
-
- vi oracle.sh
-
- #!/bin/bash
- case "$1" in
- start)
- date >>/var/log/oracle
- echo -e "\nThe oracle will start\n">/var/log/oracle
- su - oracle -c "lsnrctl start;dbstart;emctl start dbconsole;exit;">>/var/log/oracle
- echo -e "The oracle started">>/var/log/oracle
- ;;
- stop)
- date >>/var/log/oracle
- echo -e "\nThe oracle will stop\n">/var/log/oracle
- su - oracle -c "dbshut;emctl stop dbconsole;lsnrctl stop;exit;">>/var/log/oracle
- echo -e "The oracle stoped">>/var/log/oracle
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- *)
- echo -e "usage $0 {start|stop|restart}"
- exit 1
- esac
Save.
- chmod +x oracle.sh
- ln -s oracle.sh /etc/rc.d/rc3.d/S99oracle
- ln -s oracle.sh /etc/rc.d/rc5.d/S99oracle
- ln -s oracle.sh /etc/rc.d/rc0.d/K01oracle
- ln -s oracle.sh /etc/rc.d/rc6.d/K01oracle
In this way, multiple oracle instances can be automatically started.
Oracle conversion functions
Oracle string connection method
Implementation of Oracle fuzzy query
JAVA Implementation of Oracle Storage Process Creation
Oracle Stored Procedure debugging method