- 浏览: 108449 次
- 性别:
- 来自: 长沙
文章分类
最新评论
-
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 689贡献一些我平常用的监控服务器性能的命令 1.硬盘读写性能,#查 ... -
64位 linux 平台下Oracle 安装文档
2015-08-11 21:30 538转: 安装步骤和32位 基本一样,在一些参数上有些变化。 ... -
Tomcat 日志监控自动重启脚本
2013-07-11 23:23 2096因项目经常出现一些异常,导致接口挂死,定时检测日志内容进行重启 ... -
几个删除重复记录的SQL语句
2011-04-08 13:54 838比如现在有一人员表 ... -
linux 压缩命令详解
2010-04-06 10:35 730文件压缩和归档 有 ... -
linux time 命令详解
2010-04-06 10:33 1849使用方式: time [options] ... -
Oracle BIEE 中的时间维与时间轴函数
2009-12-15 17:23 2508累计、同比、环比是 BI 项目中常用的分析方法。本文讲述如 ... -
ORACLE10G修改主机名后的EM(Enterprise Manager)启动问题
2009-10-18 16:11 1541修改主机名从info到info-0073后,OR ... -
oracle 创建表空间
2009-10-18 16:10 645//创建临时表空间 create temporary t ... -
VI 命令
2008-09-23 11:14 683进入vi的命令 vi filename : ... -
tail 命令来监控系统log
2008-09-23 11:08 1176#!/bin/bash filename=sys.l ... -
ORACLE函数大全
2007-08-03 10:05 758SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十 ...
相关推荐
linux下静默安装oracle 11g
oracle在linux下无图形化界面的安装,静默安装详细步骤
静默安装过几次,都没问题。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
linux静默安装oracle11g数据库,包含oracle11g64位安装包下载地址。
Or acle 11g 基于 Centos7 静默安装教程 ( 无图形界面 , 远程安装 )
oracle 12C 自动化静默安装脚本, https://www.cnblogs.com/zhichaoma/p/9288739.html
Linux环境下安装oracle11g
详细讲解Linux 静默安装 Oracle 11g R2,步骤截图,命令;静默安装准备,安装软件,创建数据库,安装监听,删除数据库。
Linux CentOS 6.5 64位 静默安装Oracle11g 云主机
在断网条件下:在linux服务器静默安装oracle11g文档,
操作系统oracle linux 7.6,oracle 19c 静默安装文档,包括安装数据,实例,配置监听过程。centos 小红帽操作系统安装方式相同
手工建库: 1.写参数文件,创建实例: vi $ORACLE_HOME/dbs/initorcl.ora 写入以下内容: ...control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl'
Linux下oracle10g_静默安装完整版
Linux操作系统下oracle安装静默安装,2018年亲测有效!!!! 安装前准备 首先,请先以root账号登入作一些前置设定作业。 输入密码后进入root账户 4.1 操作系统准备 查看主机名 4.3安装依赖包 4.4创建安装用户、组...
Linux离线静默安装oracle11g所需依赖
在linux下静默安装oracle11g
这是Linux环境下静默安装Oracle11g的手册,适用于centos6的系统
Oraclelinux6.5 下 oracle11.2.0.3 RAC_Multipath_ASM 安装—飞扬笔记 2.3.7 修改 oracle 用户限制 ................................................................................... 13 2.3.8 修改/etc/pam.d...
Linux下Oracle静默安装 Linux版本:Red Hat Enterprise Linux 5 update 3 Oracle版本:Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86-64