1、下载:在Oracle官网上下载64位Linux Oracle 11g 的安装包,系统环境是Centos6.2
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
2、上传:用WinSCP软件将windows下的Oracle安装程序传到Linux下,解压后是database目录。
3、安装相关环境:
mkdir -p mkdir -p /u1/oracle/product/11.2.0/db_1/
chown -R oracle:oinstall /u1/oracle/
chmod -R 775 /u1/oracle/
6) 设置用户环境
su - oracle
vi /home/oracle/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
ORACLE_BASE=/u1/oracle
ORACLE_HOME=/u1/oracle/product/11.2.0/db_1
ORACLE_SID=starsl
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID ORACLE_BASE ORACLE_HOME LD_LIBRARY_PATH PATH
source .bash_profile使环境变量生效
vi /home/database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracledb
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u1/oracle/oralnventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u1/oracle/product/11.2.0/db_1
ORACLE_BASE=/u1/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=oracle
oracle.install.db.config.starterdb.SID=starsl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/usr/local/oradata/ora11g/ORA11G
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
su - oracle
/home/database/runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /home/database/response/db_install.rsp
如果顺利的话,不久后能看到下面的提示:
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
#-------------------------------------------------------------------
安装期间查看安装日志信息了解安装进度
$ cd $ORACLE_BASE/oraInventory/logs
$ tail -100f installActions*.log
安装的软件信息会写入inventory.xml文件, 如果需重运行则把该文件的对应安装条目信息删除即可:
$ vi $ORACLE_BASE/oraInventory/ContentsXML/inventory.xml
7、静默建库(注意此步骤生成oradata数据):
先配置响应文件:
$ vi /u01/database/response/dbca.rsp(我基本没有更改)
#--------------------------------------------------------------------
#以下参数不要更改
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
#以下参数必须设置
[CREATEDATABASE]
GDBNAME = "ORCL.LK"
TEMPLATENAME = "General_Purpose.dbc"
#以下参数不设置则使用默认值,建议设置
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1024"
#--------------------------------------------------------------------
种子数据库和控制文件位于$ORACLE_HOME/assistants/dbca/templates/下, 即Seed_Database.dfb和 Seed_Database.ctl文件, 实际上建库就是基于通过rman恢复种子数据库和控制文件来实现的.
$ $ORACLE_HOME/bin/dbca -silent -responseFile /u01/database/response/dbca.rsp
Enter SYS user password:
< 输入sys用户密码>
Enter SYSTEM user password:
< 输入system用户密码>
Copying database files
...
37% complete
Creating and starting Oracle instance
...
62% complete
Completing Database Creation
...
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ORCL/ORCL.log" for further details.
各参数含义如下:
-silent 表示以静默方式安装
-responseFile 表示使用哪个响应文件,必需使用绝对路径
RESPONSEFILE_VERSION 响应文件模板的版本,该参数不要更改
OPERATION_TYPE 安装类型,该参数不要更改
GDBNAME 全局数据库名,点号前面默认是db_name,点号后面默认就是db_domain
TEMPLATENAME 建库模板名,参考各模板定义:$ORACLE_HOME/assistants/dbca/templates/*.dbc
CHARACTERSET 字符集,默认是WE8MSWIN1252
TOTALMEMORY 实例内存,默认是服务器物理内存的40%
8、建库后实例检查
$ ps -ef | grep ora_ | grep -v grep | wc -l
$ ps -ef | grep ora_ | grep -v grep
9、在dbs下拷贝一份init.ora到initORCL.ora
cp /u1/oracle/admin/orcl11g/pfile/init.ora.6272012232237 /u1/oracle/product/11.2.0/db_1/dbs/initstarsl.ora
给位注意了这个initstarsl.ora,其中starsl是环境变量中的sid名称,startup启动默认启动这个库的哦。
10、startup 可能会报错说控制文件不对:
SQL> startup
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
ORA-00205: error in identifying control file, check alert log for more info
这个很好办:alter system set control_files='/u1/oracle/oradata/orcl11g/control01.ctl' scope=spfile;
然后shutdown immediate => startup
11、SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
解决方法:
mount -o remount,size=20G /dev/shm
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=20G 0 0
13、静默配置监听:
通过response文件运行netca, 生成sqlnet.ora和listener.ora文件, 位于$ORACLE_HOME/network/admin目录下:
# su - oracle
$ORACLE_HOME/bin/netca /silent /responsefile /u01/database/response/netca.rsp
ll $ORACLE_HOME/network/admin/*.ora
lsnrctl status
查看监听的方法
netstat -anlp | grep 1522
yum install lsof
lsof -i:1522
另外开启窗口用root用户运行:
/u1//oracle/oraInventory/orainstRoot.sh
/u1/app/oracle/product/11.2.0/db_1/root.sh