Oracle Environment Configuration-set power on (Linux) auto-start Oracle shutdown automatically shuts down Oracle

Source: Internet
Author: User
Tags sqlplus


Set power on (Linux) auto-start Oracle shutdown automatically shuts down Oracle

1, switch to the root user, confirm that the startup file and the shutdown file is present
[Email protected] bin]$ pwd
/u01/oracle/product/10.2.0/db_1/bin
[[email protected] bin]$ ls Dbstart
Dbstart--sqlplus script to invoke when executing startup
[[email protected] bin]$ ls Dbshut
Dbshut--sqlplus the script to invoke when executing shutdown


2. Modify the Oratab file

[Email protected] etc]$ Vim/etc/oratab

Orcl:/u01/oracle/product/10.2.0/db_1:y--Change N to Y

3. Test startup file and close file correctness

/u01/oracle/product/10.2.0/db_1/bin

[Email protected] bin]$ export ORACLE_SID=ORCL

[Email protected] bin]$ Dbshut

[Email protected] bin]$ Sqlplus/nolog

Sql*plus:release 10.2.0.1.0-production on Thu June 5 16:23:12 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.
Sql> Conn/as SYSDBA
Connected to an idle instance. --the database is closed
Note: conn/as SYSDBA = conn SYS/ORCL as Sysdba

Sql> Conn SYS/ORCL as Sysdba
Connected to an idle instance. --Connecting to an idle routine means that the database is not started

Sql> Conn Sys/[email protected] as Sysdba
ERROR:
Ora-12514:tns:listener does not currently know of service requested in Connect
Descriptor


Warning:you is no longer connected to ORACLE. --Because the database is closed, it cannot be accessed by the listener, but can only be connected as SYSDBA.

Regardless of what you do, you must connect, log in as SYSDBA to verify the operating system's password file.

[[email protected] bin]$ Dbstart--Test boot file is available
Failed to Auto-start Oracle Net listene Using/ade/vikrkuma_new/oracle/bin/tnslsnr
Processing Database instance "ORCL": Log File/u01/oracle/product/10.2.0/db_1/startup.log
[Email protected] bin]$ Sqlplus/nolog

Sql*plus:release 10.2.0.1.0-production on Thu June 5 16:30:35 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Sql> Conn/as SYSDBA
Connected. --

4. Write a shell script

[Email protected] ~]# CD/ETC/RC.D/INIT.D
[email protected] init.d]# Touch Start_shut
[Email protected] init.d]# VI Start_shut
----------------------------------------------
#!/bin/sh
Opt_=$1
Case ' $OPT _ ' in
Start
/bin/echo "$: (start)"
#
# Your service startup command goes here
#
Su-oracle-c "/u01/oracle/product/10.2.0/db_1/bin/lsnrctl Start"
Su-oracle-c "/u01/oracle/product/10.2.0/db_1/bin/dbstart"
# Note:must exit with zero unless error is server
chmod 1777/tmp
Chown sys:sys/tmp
Exit 0
;;
Stop
/bin/echo "$: (stop)"
#
# Your service shutdown command goes here.
#
Su-oralce-c "/u01/oracle/product/10.2.0/db_1/bin/dbshut"
Su-oracle-c "/u01/oracle/product/10.2.0/db_1/bin/lsnrctl Stop"
#Note: Must exit with zero unless error is server
Exit 0
;;
*)/bin/echo '
/bin/echo "Usage: $0[start|stop]"
/bin/echo "Invalid argument ==>\" ${opt_}\ ""
/bin/echo "
Exit 0
;;
Esac
----------------------------------------------------------------------------------

5. Modify Permissions

[Email protected] init.d]# chmod 755 Start_shut

6. Link the file to the boot area and close the zone

[Email protected] init.d]# CD/ETC/RC5.D
[Email protected] rc5.d]# ln-s/etc/rc.d/init.d/start_shut S99start_shut
[Email protected] rc5.d]# CD/ETC/RC0.D
[Email protected] rc0.d]# ln-s/etc/rc.d/init.d/start_shut K01start_shut

7. Test:

Init 6

Oracle Environment Configuration-set power on (Linux) auto-start Oracle shutdown automatically shuts down Oracle

Related Article

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.