Linux boot oracle

Source: Internet
Author: User


Linux boot oracle 1. Use the root user to modify the/etc/oratab file: $ vi/etc/oratab orcl:/oracle/app/product/10.2.0/db_1: N to: orcl: /oracle/app/product/10.2.0/db_1: Y * (/oracle/app/product/10.2.0) here is my oracle installation directory 2. Use the Oracle user to modify the $ ORACLE_HOME/bin/dbstart file: # su-oracle $ cd $ ORACLE_HOME/bin $ vi dbstart find ORACLE_HOME_LISTNER = ..... in this line, change it to ORACLE_HOME_LISTNER =/u01/app/oracle/product/10.2.0/db_1 or directly change it to www.2cto.com ORACLE_HO. ME_LISTNER = $ ORACLE_HOME 3. Test and run dbshut. Check whether dbstart can start the Oracle service and listener service: 1. modify the permissions of dbstart and dbshut log files: $ su-root # cd $ ORACLE_HOME # chown oracle: oinstall startup. log # chown oracle: oinstall shutdown. log Note: startup. log and shutdown. log may not exist when you run. /dbstart and. /dbshut.
2. run the corresponding script for testing # su-oracle $ cd $ ORACLE_HOME/bin $. /dbstart (. /dbshut) Processing Database instance "orcl": log file/opt/oracle/product/10.2.0/startup. log $ ps-efw | grep ora _ $ lsnrctl status found that lsnrctl has started [oracle @ localhost bin] $ ps-efw | grep LISTEN | grep-v grep oracle 3453 1 0? 00:00:00/opt/oracle/product/10.2.0/bin/tnslsnr LISTENER-inherit 4: create a service $ su-root # cd/etc/rc. d/init. d/# vi oradbstart: copy the following Script 1 or script 2 to the oradbstart file: Note: (1) # The number of lines to start must not be small. Otherwise, an error is returned when you run the chkconfig command later: the oradbstart service does not support chkconfig (2) modifying the environment variable configuration section (in blue) based on your environment (3) copying the following script content saved under windows to linux through ISO, copy the script to the oradbstart file and then run www.2cto.com. Run the vi oradbstart command on the terminal to open the script. Some lines may be followed by characters similar to ^ M and deleted, otherwise, after running the chkconfig command. d/rcN. the S99oradbstart file generated under the d directory (N is run level) is empty. You can use vi to view the S99oradbstart file, and the content should be/etc/rc. d/init. d/oradbstart file content is the same (the third case is that I use the Virtual Machine VMWARE to install linux under xp, save the following script as a text file, and then make it into an ISO file, copy the file content in ISO to oradbstart. In this case, some lines are followed by characters similar to ^ M, which cannot be seen using gredit. Only vi can be seen)
-- Script 1 (Database, listener, dbconsole, sqlplus )#! /Bin/bash # chkconfig: 345 99 10 # description: Startup Script for Oracle Databases #/etc/rc. d/init. d/dbstart export ORACLE_BASE =/u01/app/oracle/export ORACLE_HOME =/u01/app/oracle/product/10.2.0/db_1 export ORACLE_SID = orcl export PATH = $ PATH: $ ORACLE_HOME/bin ORA_OWNR = "oracle" # if the executables do not exist -- display error if [! -F $ ORACLE_HOME/bin/dbstart-o! -D $ ORACLE_HOME] then echo "Oracle startup: cannot start" exit 1 fi # depending on parameter -- startup, shutdown, restart # of the instance and listener or usage display case "$1" in start) # Oracle listener and instance startup echo-n "Starting Oracle: "su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/dbstart "touch/var/lock/Oracle su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/emctl start dbconsole "su- $ ORA_OWNR-c "$ ORACLE_HOME/bin/isqlplusctl start" echo "OK ";; www.2cto.com stop) # Oracle listener and instance shutdown echo-n "Shutdown Oracle: "su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/emctl stop dbconsole "su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/isqlplusctl stop "su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/dbshut "su-$ ORA_OWNR-c" $ ORACLE_HOME/bin/lsnrctl stop "rm-f/var/lock/Oracle echo" OK ";; reload | restart) $0 stop $0 start; *) echo "Usage: 'basename $ 0' start | stop | restart | reload" exit 1 esac exit 0
-- Script 2 (only start the database and listen )#! /Bin/bash # chkconfig: 345 99 10 # description: Startup Script for Oracle Databases #/etc/rc. d/init. d/oradbstart export ORACLE_BASE =/u01/app/Oracle/export ORACLE_HOME =/u01/app/Oracle/product/10.2.0/db_1 export ORACLE_SID = orcl export PATH = $ PATH: $ ORACLE_HOME/bin case "$1" in start) su Oracle-c $ ORACLE_HOME/bin/dbstart # (note that Oracle here is your oracle user, case sensitive, otherwise, an error occurs. Oracle) touch/var/lock/Oracle ec is also displayed. Ho "OK"; stop) echo-n "Shutdown Oracle: "su Oracle-c $ ORACLE_HOME/bin/dbshut rm-f/var/lock/Oracle echo" OK "www.2cto.com; *) echo" Usage: 'basename $ 0' start | stop "exit 1 esac exit 0 save and quit. Open the terminal and run: $ su-root # chown oracle. oinstall/etc/rc. d/init. d/oradbstart # chmod 775/etc/rc. d/init. d/oradbstart and run: chkconfig -- add oradbstart chkconfig -- list oradbstart run result: oradbstart 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: enable 6: Disable or run the following command chkconfig -- level 345 oradbstart on
5. check: according to the above running results, when the corresponding running level is on (for example: 5: on), in the corresponding/etc/rc. d/rcN. d (for example, the value corresponding to 5: on is/etc/rc. d/rc5.d) the following will generate a file: S99oradbstart, use vi S99oradbstart to open the file, you can see the content of the file and/etc/rc. d/init. d/oradbstart has the same content, indicating that the configuration is successful. In fact, S99oradbstart is one to/etc/rc. d/init. d/oradbstart link, we can use the file command to view: $ file/etc/rc. d/rc5.d/S99oradbstart S99oradbstart: symbolic link '.. /init. d/oradbstart $ ps-ef | grep oracle check whether Oracle-related processes have been started. note: In the script file :# Chkconfig: 345 99 10 indicates that the service is started at level 3, 4, and 5, and 99 is in the corresponding/etc/rc. d/rcN. d (N is the level specified above, here is 345) the serial number of the link file generated under the directory (startup priority level) S99oradbstart, 10. d/rcN. d (N is a level other than 345) the serial number of the link file generated by the Directory (priority of service stop) K10oradbstart. Www.2cto.com command Description: ps: monitoring background process-e displays all processes. -F full format. -H does not display the title. -L long format. -W width output.
Grep: A Command Used in linux to search for the content contained in the output content. For example, if you want to search for a string of characters "bbb" in aaa.txt, you can use cat aaa.txt | grep bbb 2. I want to search for files containing bb in the current directory. Use ls | grep bb For example: ps-efw | grep LISTEN | grep-v grep: To view listeners containing LISTEN, remove listeners that contain grep. Chkconfig: Function Description: Check and set various services of the system. Syntax: chkconfig [-- add] [-- del] [-- list] [System Service] Or chkconfig [-- level <level code>] [System Service] [on/off/reset] supplement note: this is a program developed by Red Hat following the GPL rules. It can query which system services the operating system will execute in each execution level, including various resident services. Parameter: -- add adds the specified system service, enables the chkconfig command to manage it, and adds relevant data to the system startup description file. -- Del: deletes the specified system service. It is no longer managed by the chkconfig command, and relevant data is also deleted in the description file started by the system.
-- List lists the specified system services. -- Level <level code> specifies the execution level of the read system service. Note: runlevel can be regarded as the system status and image. You can think of runlevel as Normal, safemode, and Command prompt only in Microsoft windows. To enter each runlevel, you need to start or close a series of services. These services are stored in the/etc/rc. d/rc? directory as initialization scripts ?. D/or/etc/rc ?. D Under www.2cto.com (? Indicates the serial number of runlevel ).
In most linux releases, there are usually eight runlevel Runlevel System State 0 Halt the system 1 Single user mode 2 Basic multi user mode 3 Multi user mode 5 Multi user mode with GUI 6 Reboot the system S, s Single user mode the default runlevel of most Desktop linux systems is 5, and the user logon is a graphical interface; the default runlevel of most server versions of linux systems is 3, the user logs on to the character interface. runlevel 1 and runlevel 2 are rarely used except debugging. runlevel s and S are not directly used by the user, but used to prepare for Single user mode. Author evan_shen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.