Oracle automatically creates instance scripts under Linux

Source: Internet
Author: User

The script requires a parameter, the name of the instance, to generate a configuration-dependent file, and a script statement to create the database for Sqlplus to run.

The statement is placed in a file under the Run script directory with the file name: Create_database_${sid}.sql.

Finally, the statement in the Create_database_${sid}.sql to get Sqlplus run.

Note: Before running, please put oracle_home, oracle_base These two environment variables set correctly

Note not how to write, because I do not understand some of the meaning of the statement, just online things sorted out. Please correct me if you have any questions

Material from the network, reproduced please specify. The script is not gold.

# SID must be valid andEnvoracle_base must be existif["$#"-eq"0"] ; ThenEcho 'no parameter'exit;fiSid=$1if[-Z"$sid"-o-z"$ORACLE _base"-o-z"$ORACLE _home"] ; ThenEcho "SID name is invalid or oracle_base unset"exit;fi#set SidEnvOracle_sid=$sid;D Atabase_space_undo=Undotbs1001ora_admin_dir= $ORACLE _base/admin/$sid; Ora_data_dir= $ORACLE _base/oradata/$sid; # Createdirof Sidora_admin_root= $ORACLE _base/admin;mkdir-P $ORA _admin_dir/Adump;mkdir-P $ORA _admin_dir/Bdump;mkdir-P $ORA _admin_dir/Cdump;mkdir-P $ORA _admin_dir/Udump;mkdir-P $ORA _admin_dir/pfile;mkdir-p $ORA _data_dir; #create ORA Passwordfileorapwdfile=${ORACLE_HOME}/DBS/ORAPW${SID} Password=${sid} entries=5Force=y; #create. Orafile  forinit your sid#CP${oracle_home}/dbs/init.ora ${oracle_home}/dbs/init${sid}.ora#edit. Orafile#as Follow is exmple for. orafileCat> ${oracle_home}/dbs/init${sid}.ora <<eof############################################################################### Copyright (c)1991,2001,2002by Oracle corporation####################################################################################### ################################### Cache and I/o########################################## #db_block_size=8192Db_file_multiblock_read_count= -############################################ Cursors and Library cache######################################## # # #open_cursors= -############################################ Database identification######################################## # # #db_domain=""db_name=${sid}############################################ Diagnostics and statistics################################ ########## #background_dump_dest= $ORA _admin_dir/bdumpcore_dump_dest= $ORA _admin_dir/cdumpuser_dump_dest= $ORA _admin_dir/udump############################################ File configuration######################################## # # #control_files=("$ORA _data_dir/control01.ctl","$ORA _data_dir/control02.ctl","$ORA _data_dir/control03.ctl") Db_recovery_file_dest= $ORACLE _base/flash_recovery_areadb_recovery_file_dest_size=2147483648############################################ Job queues########################################## #job_queue_ Processes=Ten############################################ miscellaneous########################################### Compatible=10.2.0.1.0############################################ Network registration########################################### # #local_listener=listener_blog############################################ Processes and sessions############################# ############# #processes= Max############################################ SGA memory########################################## #sga_target =605028352############################################ Security and auditing########################################### Audit_file_dest= $ORA _admin_dir/Adumpremote_login_passwordfile=exclusive############################################ Shared server######################################### # #dispatchers="(PROTOCOL=TCP) (SERVICE=${SID}XDB)"############################################ Sort, Hash Joins, Bitmap indexes################################## ######## #pga_aggregate_target=201326592############################################ System Managed Undo and Rollback segments########################## ################ #undo_management=Autoundo_tablespace=$DATABASE _space_undoeofCat> Create_database_${sid}.sql <<Eofsqlplus/As sysdba;startup nomount pfile= $ORACLE _home/dbs/Init${sid}.ora; CREATE DATABASE ${sid}controlfile reuselogfile GROUP1('$ORA _data_dir/redo01.log') SIZE 10M reuse, GROUP2('$ORA _data_dir/redo02.log') SIZE 10M reuse, GROUP3('$ORA _data_dir/redo03.log') SIZE 10M reusedatafile'$ORA _data_dir/system01.dbf'SIZE 500MEXTENT MANAGEMENT localsysaux datafile'$ORA _data_dir/sysaux01.dbf'size 120M Reuse autoextend on next 10240K maxsize unlimitedundo tablespace ${database_space_undo} datafile'$ORA _data_dir/undotbs01.dbf'SIZE 500MDEFAULT temporary tablespace temptempfile'$ORA _data_dir/temp01.dbf'size 500MEXTENT MANAGEMENT LOCAL UNIFORM SIZE 10MNOARCHIVELOGMAXDATAFILES +CHARACTER set utf8national CHARACTER set Utf8maxlogfilesTen;@?/rdbms/admin/catalog.sql;@?/rdbms/admin/catproc.sql;@?/sqlplus/admin/Pupbld.sql;exit; EOF
View Code

Oracle automatically creates instance scripts under Linux

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.