- 浏览: 110992 次
- 性别:
- 来自: 长沙
文章分类
最新评论
-
guanglizi:
V和\2表示什么?好像没见过
javascript常用日期验证 -
梅花簪:
不支持chrome,ff
固定表头列头Javascript代码 -
xy5811:
新浪微博应该不是直接用的这个算法,至少chars数组中顺序不一 ...
微博短链接的生成算法(Java版本) -
struts_2010:
...
MyEclipse 6.5 GA 下载 + 汉化方法 + 序列号 -
闫村林:
...
spring Hibernate struts整合配置(一)
文章也是以前找的,发现原链接已删除,故重新发一下。
如果Server段没有安装X界面,如何来安装Oracle呢?我们可以使用Oracle提供的静默安装来实现提示符下的Oracle安装。安装前的系统环境变量及内核参数的设置这里就不重复了,可以查看安装光盘中的安装文档。
假设Oracle安装文件已经解压至/u02 。
su - oracle
mkdir -p /u01/app/oracle/
1. 建立静默安装的配置文件
cd /u02/database/response
vi enterprise01.rsp
RESPONSEFILE_VERSION=2.2.1.0.0
FROM_LOCATION="../stage/products.xml"
ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_1/"
ORACLE_HOME_NAME="OraDb10g_home1"
TOPLEVEL_COMPONENT={"racle.server","10.2.0.1.0"}
DEINSTALL_LIST={"racle.server","10.2.0.1.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=false
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_ROOTSH_CONFIRMATION=false
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
ACCEPT_LICENSE_AGREEMENT=true
COMPONENT_LANGUAGES={"en"}
CLUSTER_NODES=
INSTALL_TYPE="EE"
s_nameForDBAGrp=dba
s_nameForOPERGrp=dba
b_oneClick=false
SHOW_DATABASE_CONFIGURATION_PAGE=false
b_createStarterDB=false
相关属性的值的意义,请参考Oracle提供的enterprise.rsp文档中的说明 。
2. 开始安装
cd /u02/database/
./runInstaller -silent -responseFile /mnt/data01/software/database/response/enterprise01.rsp
#注意-responseFile参数后的文件路径一定是绝对路径 ,并且enterprise01.rsp oracle用户可读。
执行过程如下:
Installation in progress (Mon May 12 20:27:18 CST 2008)
............................................................... 11% Done.
............................................................... 23% Done.
............................................................... 35% Done.
............................................................... 47% Done.
........................................... 55% Done.
Install successful
Linking in progress (Mon May 12 20:30:01 CST 2008)
. 55% Done.
Link successful
Setup in progress (Mon May 12 20:31:21 CST 2008)
.................... 100% Done.
Setup successful
End of install phases.(Mon May 12 20:31:29 CST 2008)
Starting to execute configuration assistants
Configuration assistant "Oracle Net Configuration Assistant" succeeded
Configuration assistant "Oracle Database Configuration Assistant" failed
SEVEREUI-10104:Some of the configuration assistants failed. It is strongly recommended that you retry the configuration assistants at this time. Not successfully running any "Recommended" assistants means your system will not be correctly configured. Select the failed assistants and click the 'Retry' button to retry them.
--------------------------------------
The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolFailedCommands" script contains all commands that failed, were skipped or were cancelled. This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolAllCommands" script contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
--------------------------------------
The installation of Oracle Database 10g was successful, but some optional configuration assistants failed, were cancelled or skipped.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log' for more details.
3. 运行安装所需脚本
vi /u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log
查看日志,提示我们用root用户运行如下两个脚本
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/10.2.0/db_1/root.sh
至此Oracle的产品已经安装完成,可是目前为止我们还没有建立数据库。
由于没有X界面无法启动dbca ,所以不能用dbca来帮我们建立数据库。这时候你可能会想到用create database 语句来建立数据库,可是语法实在是繁琐,并且还要运行许多的
oracle脚本 。
下面我们来利用oracle提供的种子数据库还原一个数据库出来。
假设我们要建立的数据库的名称为orcl 。
4.建立我们所需的目录。
mkdir -p /mnt/data01/opt/oracle/admin/orcl/{a,b,u}dump
mkdir -p /mnt/data01/opt/oracle/oradata/orcl
#mkdir -p /mnt/data01/opt/oracle/admin/orcl/{a,b,u}dump
#mkdir -p /mnt/data01/opt/oracle/oradata/orcl
找到oracle为种子数据库提供的控制文件并copy至/u01/app/oracle/oradata/orcl 。
cd /mnt/data01/opt/oracle/product/10.2.0/db_1/assistants/dbca/templates/
cp Seed_Database.ctl /mnt/data01/opt/oracle/oradata/orcl
5.建立pfile文件
cd /mnt/data01/opt/oracle/product/10.2.0/db_1/dbs
vi initorcl.ora
*.db_name=SEEDDATA #注:因为Seed_Database.ctl控制文件中记录的db_name为SEEDDATA。
control_files='/mnt/data01/opt/oracle/oradata/orcl/Seed_Database.ctl'
compatible=10.2.0.1.0
6.启动数据库到mount状态
sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 12 21:48:47 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 117440512 bytes
Fixed Size 1218004 bytes
Variable Size 58722860 bytes
Database Buffers 50331648 bytes
Redo Buffers 7168000 bytes
Database mounted.
使用默认的参数建立spfile
SQL> create spfile from pfile;
重新启动数据库
SQL> shutdown immediate
SQL> startup mount
更改sga_max_size,sga_target参数的值 。
SQL> alter system set sga_max_size=400M scope=spfile;
SQL> alter system set sga_target=260M scope=spfile;
然后再次重新启动数据库
SQL> shutdown immediate
SQL> startup mount
7.用rman连接数据库
rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon May 12 21:52:01 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: SEEDDATA (DBID=3891038516, not open)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 89.23M DISK 00:00:36 30-JUN-05
BP Key: 1 Status: AVAILABLE Compressed: YES Tag:
Piece Name: /ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf
2 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf
3 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf
4 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf
可以看到,我们可以利用/ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb这个备份集来还原数据库。
但 是很明显我们系统中并没有这样一个文件/ade/aime_10.2_lnx_push/oracle/oradata /Seed_Database.dfb ,但是查找发现路径/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates下有 Seed_Database.dfb文件 。
有两种方法,一个是建立一个软链接/ade/aime_10.2_lnx_push/oracle /oradata/Seed_Database.dfb 指向/mnt/data01/opt/oracle/product/10.2.0/db_1/assistants/dbca/templates /Seed_Database.dfb 。另一个是创建目录/ade/aime_10.2_lnx_push/oracle/oradata/
并将Seed_Database.dfb copy至其下 。
8.还原数据库
run {
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf' to '/u01/app/oracle/oradata/orcl/system01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf' to '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf' to '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf' to '/u01/app/oracle/oradata/orcl/users01.dbf';
restore database;
switch datafile all;
}
cd /u01/app/oracle/oradata/orcl
[oracle@man /u01/app/oracle/oradata/orcl]$ ls
Seed_Database.ctl sysaux01.dbf system01.dbf undotbs01.dbf users01.dbf
可以看到我们所需要的数据文件都还原回来了,但是现在还缺少log file 。
我们现在打开数据库。
因为控制文件中记录的log file路径为 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata 所以要先创建相应的目录。
SQL> alter database open resetlogs;
此时,在目录/ade/aime_10.2_lnx_push/oracle/oradata/seeddata 下创建了redo01.log,redo02.log,redo03.log,temp01.dbf文件。
我们要更改这几个文件的路径,所以先将数据库关闭,然后cp /ade/aime_ship_10gR2_050630.0022/oracle/oradata/seeddata/* /mnt/data01/opt/oracle/oradata/orcl/
启动数据库到mount状态,并更改日志和临时文件的路径
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo01.log' to '/u01/app/oracle/oradata/orcl/redo01.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo02.log' to '/u01/app/oracle/oradata/orcl/redo02.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo03.log' to '/u01/app/oracle/oradata/orcl/redo03.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/temp01.dbf' to '/u01/app/oracle/oradata/orcl/temp01.dbf';
Database altered.
SQL> alter database open;
到此数据库已经建立,并且数据文件也放到了我们期待的地方。但是还有一个问题,就是数据库名称不是我们事先期待的。
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string SEEDDATA
db_unique_name string SEEDDATA
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string SEEDDATA
下面我们将数据库名称SEEDDATA改成我们需要的orcl 。注意此时仅仅更改参数文件的值是不行的,因为控制文件中同样也记录着数据库的名称。
9.更改数据库名称
备份控制文件脚本
SQL> alter database backup controlfile to trace as '/tmp/ctl2.txt';
SQL> create pfile from spfile;
将spfile删除,编辑pfile将db_name="SEEDDATA" 改成 db_name="orcl" 。
vi /tmp/ctl.txt 将其中如下一段
CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf',
'/u01/app/oracle/oradata/orcl/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf',
'/u01/app/oracle/oradata/orcl/tt.dbf'
CHARACTER SET US7ASCII
;
修改为
CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" set database "ORCL" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/mnt/data/opt/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/mnt/data/opt/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/mnt/data/opt/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/mnt/data/opt/oracle/oradata/orcl/system01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/undotbs01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/sysaux01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/users01.dbf'
CHARACTER SET ZHS16GBK
;
重新启动数据库到nomount状态 。
运行上面的建立控制文件的脚本,然后打开数据库 。
SQL> alter database open resetlogs;
10.控制文件更名并实现冗余。
修改参数文件initorcl.ora
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
,'/u01/app/oracle/oradata/orcl/control03.ctl'
cd /u01/app/oracle/oradata/orcl
mv Seed_Database.ctl control01.ctl
cp control01.ctl control02.ctl
cp control01.ctl control03.ctl
重新启动数据库,大功告成!
STARTUP NOMOUNT
CREATE CONTROLFILE set database "ORCL" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/mnt/data01/opt/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/mnt/data01/opt/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/mnt/data01/opt/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/mnt/data01/opt/oracle/oradata/orcl/system01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/undotbs01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/sysaux01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/users01.dbf'
CHARACTER SET ZHS16GBK
;
如果Server段没有安装X界面,如何来安装Oracle呢?我们可以使用Oracle提供的静默安装来实现提示符下的Oracle安装。安装前的系统环境变量及内核参数的设置这里就不重复了,可以查看安装光盘中的安装文档。
假设Oracle安装文件已经解压至/u02 。
su - oracle
mkdir -p /u01/app/oracle/
1. 建立静默安装的配置文件
cd /u02/database/response
vi enterprise01.rsp
RESPONSEFILE_VERSION=2.2.1.0.0
FROM_LOCATION="../stage/products.xml"
ORACLE_HOME="/u01/app/oracle/product/10.2.0/db_1/"
ORACLE_HOME_NAME="OraDb10g_home1"
TOPLEVEL_COMPONENT={"racle.server","10.2.0.1.0"}
DEINSTALL_LIST={"racle.server","10.2.0.1.0"}
SHOW_SPLASH_SCREEN=false
SHOW_WELCOME_PAGE=false
SHOW_COMPONENT_LOCATIONS_PAGE=false
SHOW_CUSTOM_TREE_PAGE=false
SHOW_SUMMARY_PAGE=false
SHOW_INSTALL_PROGRESS_PAGE=false
SHOW_REQUIRED_CONFIG_TOOL_PAGE=false
SHOW_CONFIG_TOOL_PAGE=false
SHOW_RELEASE_NOTES=false
SHOW_ROOTSH_CONFIRMATION=false
SHOW_END_SESSION_PAGE=false
SHOW_EXIT_CONFIRMATION=false
NEXT_SESSION=false
NEXT_SESSION_ON_FAIL=false
SHOW_DEINSTALL_CONFIRMATION=false
SHOW_DEINSTALL_PROGRESS=false
ACCEPT_LICENSE_AGREEMENT=true
COMPONENT_LANGUAGES={"en"}
CLUSTER_NODES=
INSTALL_TYPE="EE"
s_nameForDBAGrp=dba
s_nameForOPERGrp=dba
b_oneClick=false
SHOW_DATABASE_CONFIGURATION_PAGE=false
b_createStarterDB=false
相关属性的值的意义,请参考Oracle提供的enterprise.rsp文档中的说明 。
2. 开始安装
cd /u02/database/
./runInstaller -silent -responseFile /mnt/data01/software/database/response/enterprise01.rsp
#注意-responseFile参数后的文件路径一定是绝对路径 ,并且enterprise01.rsp oracle用户可读。
执行过程如下:
Installation in progress (Mon May 12 20:27:18 CST 2008)
............................................................... 11% Done.
............................................................... 23% Done.
............................................................... 35% Done.
............................................................... 47% Done.
........................................... 55% Done.
Install successful
Linking in progress (Mon May 12 20:30:01 CST 2008)
. 55% Done.
Link successful
Setup in progress (Mon May 12 20:31:21 CST 2008)
.................... 100% Done.
Setup successful
End of install phases.(Mon May 12 20:31:29 CST 2008)
Starting to execute configuration assistants
Configuration assistant "Oracle Net Configuration Assistant" succeeded
Configuration assistant "Oracle Database Configuration Assistant" failed
SEVEREUI-10104:Some of the configuration assistants failed. It is strongly recommended that you retry the configuration assistants at this time. Not successfully running any "Recommended" assistants means your system will not be correctly configured. Select the failed assistants and click the 'Retry' button to retry them.
--------------------------------------
The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolFailedCommands" script contains all commands that failed, were skipped or were cancelled. This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
The "/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/configToolAllCommands" script contains all commands to be executed by the configuration assistants. This file may be used to run the configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
--------------------------------------
The installation of Oracle Database 10g was successful, but some optional configuration assistants failed, were cancelled or skipped.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log' for more details.
3. 运行安装所需脚本
vi /u01/app/oracle/oraInventory/logs/silentInstall2008-05-12_08-26-55PM.log
查看日志,提示我们用root用户运行如下两个脚本
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/10.2.0/db_1/root.sh
至此Oracle的产品已经安装完成,可是目前为止我们还没有建立数据库。
由于没有X界面无法启动dbca ,所以不能用dbca来帮我们建立数据库。这时候你可能会想到用create database 语句来建立数据库,可是语法实在是繁琐,并且还要运行许多的
oracle脚本 。
下面我们来利用oracle提供的种子数据库还原一个数据库出来。
假设我们要建立的数据库的名称为orcl 。
4.建立我们所需的目录。
mkdir -p /mnt/data01/opt/oracle/admin/orcl/{a,b,u}dump
mkdir -p /mnt/data01/opt/oracle/oradata/orcl
#mkdir -p /mnt/data01/opt/oracle/admin/orcl/{a,b,u}dump
#mkdir -p /mnt/data01/opt/oracle/oradata/orcl
找到oracle为种子数据库提供的控制文件并copy至/u01/app/oracle/oradata/orcl 。
cd /mnt/data01/opt/oracle/product/10.2.0/db_1/assistants/dbca/templates/
cp Seed_Database.ctl /mnt/data01/opt/oracle/oradata/orcl
5.建立pfile文件
cd /mnt/data01/opt/oracle/product/10.2.0/db_1/dbs
vi initorcl.ora
*.db_name=SEEDDATA #注:因为Seed_Database.ctl控制文件中记录的db_name为SEEDDATA。
control_files='/mnt/data01/opt/oracle/oradata/orcl/Seed_Database.ctl'
compatible=10.2.0.1.0
6.启动数据库到mount状态
sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 12 21:48:47 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 117440512 bytes
Fixed Size 1218004 bytes
Variable Size 58722860 bytes
Database Buffers 50331648 bytes
Redo Buffers 7168000 bytes
Database mounted.
使用默认的参数建立spfile
SQL> create spfile from pfile;
重新启动数据库
SQL> shutdown immediate
SQL> startup mount
更改sga_max_size,sga_target参数的值 。
SQL> alter system set sga_max_size=400M scope=spfile;
SQL> alter system set sga_target=260M scope=spfile;
然后再次重新启动数据库
SQL> shutdown immediate
SQL> startup mount
7.用rman连接数据库
rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Mon May 12 21:52:01 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: SEEDDATA (DBID=3891038516, not open)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 89.23M DISK 00:00:36 30-JUN-05
BP Key: 1 Status: AVAILABLE Compressed: YES Tag:
Piece Name: /ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf
2 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf
3 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf
4 Full 446074 30-JUN-05 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf
可以看到,我们可以利用/ade/aime_10.2_lnx_push/oracle/oradata/Seed_Database.dfb这个备份集来还原数据库。
但 是很明显我们系统中并没有这样一个文件/ade/aime_10.2_lnx_push/oracle/oradata /Seed_Database.dfb ,但是查找发现路径/u01/app/oracle/product/10.2.0/db_1/assistants/dbca/templates下有 Seed_Database.dfb文件 。
有两种方法,一个是建立一个软链接/ade/aime_10.2_lnx_push/oracle /oradata/Seed_Database.dfb 指向/mnt/data01/opt/oracle/product/10.2.0/db_1/assistants/dbca/templates /Seed_Database.dfb 。另一个是创建目录/ade/aime_10.2_lnx_push/oracle/oradata/
并将Seed_Database.dfb copy至其下 。
8.还原数据库
run {
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/system01.dbf' to '/u01/app/oracle/oradata/orcl/system01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/sysaux01.dbf' to '/u01/app/oracle/oradata/orcl/sysaux01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/undotbs01.dbf' to '/u01/app/oracle/oradata/orcl/undotbs01.dbf';
set newname for datafile '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/users01.dbf' to '/u01/app/oracle/oradata/orcl/users01.dbf';
restore database;
switch datafile all;
}
cd /u01/app/oracle/oradata/orcl
[oracle@man /u01/app/oracle/oradata/orcl]$ ls
Seed_Database.ctl sysaux01.dbf system01.dbf undotbs01.dbf users01.dbf
可以看到我们所需要的数据文件都还原回来了,但是现在还缺少log file 。
我们现在打开数据库。
因为控制文件中记录的log file路径为 /ade/aime_10.2_lnx_push/oracle/oradata/seeddata 所以要先创建相应的目录。
SQL> alter database open resetlogs;
此时,在目录/ade/aime_10.2_lnx_push/oracle/oradata/seeddata 下创建了redo01.log,redo02.log,redo03.log,temp01.dbf文件。
我们要更改这几个文件的路径,所以先将数据库关闭,然后cp /ade/aime_ship_10gR2_050630.0022/oracle/oradata/seeddata/* /mnt/data01/opt/oracle/oradata/orcl/
启动数据库到mount状态,并更改日志和临时文件的路径
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo01.log' to '/u01/app/oracle/oradata/orcl/redo01.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo02.log' to '/u01/app/oracle/oradata/orcl/redo02.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/redo03.log' to '/u01/app/oracle/oradata/orcl/redo03.log';
Database altered.
SQL> alter database rename file '/ade/aime_10.2_lnx_push/oracle/oradata/seeddata/temp01.dbf' to '/u01/app/oracle/oradata/orcl/temp01.dbf';
Database altered.
SQL> alter database open;
到此数据库已经建立,并且数据文件也放到了我们期待的地方。但是还有一个问题,就是数据库名称不是我们事先期待的。
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string SEEDDATA
db_unique_name string SEEDDATA
global_names boolean FALSE
instance_name string orcl
lock_name_space string
log_file_name_convert string
service_names string SEEDDATA
下面我们将数据库名称SEEDDATA改成我们需要的orcl 。注意此时仅仅更改参数文件的值是不行的,因为控制文件中同样也记录着数据库的名称。
9.更改数据库名称
备份控制文件脚本
SQL> alter database backup controlfile to trace as '/tmp/ctl2.txt';
SQL> create pfile from spfile;
将spfile删除,编辑pfile将db_name="SEEDDATA" 改成 db_name="orcl" 。
vi /tmp/ctl.txt 将其中如下一段
CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/orcl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/orcl/system01.dbf',
'/u01/app/oracle/oradata/orcl/undotbs01.dbf',
'/u01/app/oracle/oradata/orcl/sysaux01.dbf',
'/u01/app/oracle/oradata/orcl/users01.dbf',
'/u01/app/oracle/oradata/orcl/tt.dbf'
CHARACTER SET US7ASCII
;
修改为
CREATE CONTROLFILE REUSE DATABASE "SEEDDATA" set database "ORCL" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/mnt/data/opt/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/mnt/data/opt/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/mnt/data/opt/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/mnt/data/opt/oracle/oradata/orcl/system01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/undotbs01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/sysaux01.dbf',
'/mnt/data/opt/oracle/oradata/orcl/users01.dbf'
CHARACTER SET ZHS16GBK
;
重新启动数据库到nomount状态 。
运行上面的建立控制文件的脚本,然后打开数据库 。
SQL> alter database open resetlogs;
10.控制文件更名并实现冗余。
修改参数文件initorcl.ora
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
,'/u01/app/oracle/oradata/orcl/control03.ctl'
cd /u01/app/oracle/oradata/orcl
mv Seed_Database.ctl control01.ctl
cp control01.ctl control02.ctl
cp control01.ctl control03.ctl
重新启动数据库,大功告成!
STARTUP NOMOUNT
CREATE CONTROLFILE set database "ORCL" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/mnt/data01/opt/oracle/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/mnt/data01/opt/oracle/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/mnt/data01/opt/oracle/oradata/orcl/redo03.log' SIZE 50M
DATAFILE
'/mnt/data01/opt/oracle/oradata/orcl/system01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/undotbs01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/sysaux01.dbf',
'/mnt/data01/opt/oracle/oradata/orcl/users01.dbf'
CHARACTER SET ZHS16GBK
;
发表评论
-
linux磁盘读写性能监控
2015-08-11 21:32 727贡献一些我平常用的监控服务器性能的命令 1.硬盘读写性能,#查 ... -
64位 linux 平台下Oracle 安装文档
2015-08-11 21:30 565转: 安装步骤和32位 基本一样,在一些参数上有些变化。 ... -
Tomcat 日志监控自动重启脚本
2013-07-11 23:23 2128因项目经常出现一些异常,导致接口挂死,定时检测日志内容进行重启 ... -
几个删除重复记录的SQL语句
2011-04-08 13:54 874比如现在有一人员表 ... -
linux 压缩命令详解
2010-04-06 10:35 780文件压缩和归档 有 ... -
linux time 命令详解
2010-04-06 10:33 1877使用方式: time [options] ... -
Oracle BIEE 中的时间维与时间轴函数
2009-12-15 17:23 2580累计、同比、环比是 BI 项目中常用的分析方法。本文讲述如 ... -
ORACLE10G修改主机名后的EM(Enterprise Manager)启动问题
2009-10-18 16:11 1568修改主机名从info到info-0073后,OR ... -
oracle 创建表空间
2009-10-18 16:10 675//创建临时表空间 create temporary t ... -
VI 命令
2008-09-23 11:14 706进入vi的命令 vi filename : ... -
tail 命令来监控系统log
2008-09-23 11:08 1207#!/bin/bash filename=sys.l ... -
ORACLE函数大全
2007-08-03 10:05 818SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十 ...
相关推荐
### Linux下静默安装Oracle 11g 在企业级应用环境中,Oracle 数据库系统以其高性能、高可靠性受到广泛欢迎。然而,在Linux环境下部署Oracle数据库可能会遇到一系列挑战,特别是对于那些希望采用自动化或批量安装...
在Linux环境下,静默安装Oracle数据库是一个高效且无需图形化界面的方法,尤其适用于自动化部署或服务器维护。以下是一个详尽的静默安装步骤指南: 1. **准备工作**:首先,你需要下载Oracle数据库的Linux安装包,...
本主题聚焦于在Linux环境下对Oracle 12c的静默安装过程,这通常是为了实现自动化部署,提高效率并减少人为错误。以下是对这个静默安装脚本的详细解释。 首先,"Linux Oracle12c静默安装脚本"意味着我们将利用命令行...
静默安装过几次,都没问题。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
linux静默安装oracle11g数据库,包含oracle11g64位安装包下载地址。
Linux环境下安装Oracle数据库是一个涉及多个步骤和技术细节的过程。在Oracle 11g R2的安装中,特别是在Linux操作系统上,需要安装一系列依赖包、配置系统环境变量、创建用户和目录、修改系统配置等关键步骤。以下是...
Or acle 11g 基于 Centos7 静默安装教程 ( 无图形界面 , 远程安装 )
下面是 CentOS 7 下静默安装 Oracle 11g 的详细步骤。 创建用户和组 在安装 Oracle 之前,需要创建用户和组,包括 oinstall 和 dba 组,以及 oracle 用户。使用以下命令创建用户和组: ``` groupadd oinstall ...
【Linux 静默安装 Oracle 11g R2】是一种高效且低错误率的数据库部署方式,尤其适合大规模环境下的自动化部署。本教程将详细解释如何在Linux系统上进行Oracle 11g R2的静默安装。 首先,安装前的准备工作至关重要。...
Oracle Linux 7.6环境下Oracle 19c的静默安装是一项涉及多个配置步骤的过程,旨在自动化安装过程,减少人工干预。静默安装允许安装者通过预先编写好的配置文件来指定安装选项,以达到无需交互的安装体验。本文将详细...
在断网条件下:在linux服务器静默安装oracle11g文档,
### Linux CentOS 6.5 64位 静默安装Oracle11g 云主机 #### 概述 在Linux CentOS 6.5 64位系统上静默安装Oracle11g数据库是一项常见的任务,尤其对于云主机而言,由于它们往往运行在无图形界面的环境中,因此静默...
在Linux环境下安装Oracle 10g数据库时,静默安装是一种高效且自动化的方式,尤其适合大规模部署或自动化运维。以下是对静默安装过程的详细解释: 1. **下载与解压安装包** Oracle 10g 提供了针对不同处理器架构的...
这是经过测试环境测试后,在正式环境中安装完成成功的...安装教程超级详细,CentOS7.5静默安装ORACLE12C教程,包含安装所需的配置文件db_install.rsp、dbca.rsp、netca.rsp、listener.ora、tnsnames.ora等详细信息。
在CentOS环境下进行Oracle 10g R2的静默安装和手工建库的过程中,涉及到诸多知识点和操作步骤。以下是对这些知识点的详细说明: 1. 安装前的准备工作 在开始安装Oracle 10g R2之前,需要做好一系列的准备工作,以...
手工建库: 1.写参数文件,创建实例: vi $ORACLE_HOME/dbs/initorcl.ora 写入以下内容: ...control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
### Linux静默安装Oracle 11g R2的详尽指南 #### 一、环境确认与准备 在开始Oracle 11g R2的静默安装之前,首先需要确保目标服务器满足基本硬件需求及系统配置。 **物理内存**: 至少需要512MB的物理内存,实际...
在Linux环境下安装Oracle 11g R2数据库时,静默安装是一种高效且方便的方法,尤其适用于自动化部署。本文将详细介绍如何在Red Hat Enterprise Linux 5.3 x86-64操作系统上进行Oracle 11g R2的静默安装。 首先,确保...