图文详解Oracle10g在RedHat Linux6.5_x64上的安装
一.修改系统版本Oracle10g时代,Red Hat版本还是4.x,根据不认识6.5版本,因此在安装时作兼容性检查时会报错,解决办法是更改系统版本信息文件/etc/redhat-release,将6.5改为4.8。二.设置内核参数vi /etc/sysctl.confkernel.shmall = 2097152kernel.shmmax =
一.修改系统版本
Oracle10g时代,Red Hat版本还是4.x,根据不认识6.5版本,因此在安装时作兼容性检查时会报错,解决办法是更改系统版本信息文件/etc/redhat-release,将6.5改为4.8。
二.设置内核参数
vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
fs.file-max = 101365
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.ipv4.ip_local_port_range = 1024 65000
运行以下命令使其生效: #/sbin/sysctl -p 生效
使用sysctl -a查看
三.创建oracle用户和组
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
# /usr/sbin/useradd -g oinstall -G dba oracle -d /home/oracle
# chmod -R 755 /home/oracle
# chown oracle:oinstall /home/oracle
# passwd oracle
四.安装Xmanager
如果你是在本机上安装,可以忽略此步骤。我是在windows下用仿真终端远程登录Linux的,因此需要安装Xmanager来显示图形界面。安装完后,用Xshell以oracle登录Linux,执行以下环境变量操作:
1
2
|
export
DISPLAY=198.20.1.21.0:0 (198.20.1.21为windows的IP)
xhost +
|
在终端会话选项下勾选 Forward X11 connections to: Xmanager,启动Xmanager passive被动接受连接。
五.安装Oracle
以oracle登录:
1
|
cpio -idmv < 10201_database_linux_x86_64.cpio
|
进入database目录,执行:
1
|
.
/runInstaller
|
如果一切正常,应该会弹出以下界面:
填好数据库名及管理用户的密码。如果不在这里创建数据库,也可以在安装完成后,执行dbca安装数据库。点击下一步。
系统兼容性检查。下一步
点Install安装
中途会报一个错,点Continue忽略它,是此版本的一个Bug
配置助手,会自动帮你配置一些东西
开始安装数据库
完成后,会出现下面界面
此处可以重新配置sys及system的密码,如果需要,点Password Management
出现上面界面时,先以root用户登录,执行root.sh后再点OK按钮。因为我之前装过一次,所以会提示是否覆盖。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
[root@SMNG2021 10g]
# ./root.sh
Running Oracle10 root.sh script...
The following environment variables are
set
as:
ORACLE_OWNER= oracle
ORACLE_HOME=
/home/oracle/db/product/10g
Enter the full pathname of the
local
bin directory: [
/usr/local/bin
]:
The
file
"dbhome"
already exists
in
/usr/local/bin
. Overwrite it? (y
/n
)
[n]: y
Copying dbhome to
/usr/local/bin
...
The
file
"oraenv"
already exists
in
/usr/local/bin
. Overwrite it? (y
/n
)
[n]: y
Copying oraenv to
/usr/local/bin
...
The
file
"coraenv"
already exists
in
/usr/local/bin
. Overwrite it? (y
/n
)
[n]: y
Copying coraenv to
/usr/local/bin
...
Creating
/etc/oratab
file
...
Entries will be added to the
/etc/oratab
file
as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
|
完成后,点Exit,完成Oracle的安装。
六.配置ora文件
/home/oracle/db/product/10g/network/admin/tnsnames.ora(本机登录sqlplus需用到此文件)
1
2
3
4
5
6
7
8
|
CCBDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 198.20.1.21)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ccbdb)
)
)
|
/home/oracle/db/product/10g/network/admin/listener.ora,(远程客户端登录侦听程序lsnrctl需用到此文件)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME =
/home/oracle/db/product/10g
)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ccbdb)
(ORACLE_HOME =
/home/db/oracle/product/10g
)
(SID_NAME = CCBDB)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 198.20.1.21)(PORT = 1521))
)
)
|
如果直接sqlplus “ /as sysdba “ 则使用的是UDP协议,直联本机数据库服务器。
如果sqlplus xydpb/xydpb@ods 则使用的是TCP协议,联的服务器取决于tnsnames.ora里的配置。而要让ORACL侦听TCP端口1521 需修改listener.ora
七.配置环境变量
1
2
3
4
5
6
7
|
ORACLE_BASE=
/home/oracle/db
ORACLE_HOME=$ORACLE_BASE
/product/10g
ORACLE_SID=CCBDB
#与上面tnsnames.ora上配置的要一致
PATH=$PATH:$HOME
/bin
:$ORACLE_HOME
/bin
LD_LIBRARY_PATH=$ORACLE_HOME
/lib
:
/usr/lib
LANG=AMERICAN_AMERICA.ZHS16GBK
export
ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH LANG
|
八.查看目前系统情况
已经建了很多dbf数据文件及控制文件等。
有如下一些配置文件
oracle服务已经启动
八.启动实例
1
|
sqlplus
"/as sysdba"
|
进入后执行
1
|
startup
|
于是问题来了:
-
问题:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file ‘/home/oracle/db/product/10g/dbs/initCCBDB.ora’
解决:
到/home/oracle/db/product/10g/dbs下,执行cp initdw.ora initCCBDB.ora
-
问题:
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORA-00371: not enough shared pool memory,should be atleast 128265318 bytes
解决:
改initCCBDB.ora参数:
# Shared pool size should be, in general, equal to 5-10% of the
# available memory. Data warehouses typically do not require as much
# memory for shared pool as OLTP systems.
#shared_pool_size = 20M #DEMO
#shared_pool_size = 50M #SMALL
shared_pool_size = 400M #MEDIUM
#shared_pool_size = 800M #LARGE
-
问题:
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORA-01506: missing or illegal database name
解决:
打开initCCBDB.ora设置db_name = CCBDB
-
问题
ORA-01102: cannot mount database in EXCLUSIVE mode
解决 :
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[oracle@SMNG2021 dbs]$
pwd
/home/oracle/db/product/10g/dbs
[oracle@SMNG2021 dbs]$
ls
hc_CCBDB.dat hc_ccbdb.dat init.ora initCCBDB.ora initdw.ora lkCCBDB orapwccbdb spfileccbdb.ora
查看使用lkCCBDB的进程
[oracle@SMNG2021 dbs]$ fuser -u lkCCBDB
lkCCBDB: 19214(oracle) 19216(oracle) 19218(oracle) 19220(oracle) 19222(oracle) 19224(oracle) 19226(oracle) 19228(oracle) 19230(oracle) 19232(oracle) 19234(oracle) 19243(oracle) 20197(oracle) 20199(oracle) 25346(oracle)
杀了它们
[oracle@SMNG2021 dbs]$ fuser -k lkCCBDB
lkCCBDB: 19214 19216 19218 19220 19222 19224 19226 19228 19230 19232 19234 19243 20197 20199 25386
[oracle@SMNG2021 dbs]$ fuser -u lkCCBDB
|
-
问题
ORA-00205: error in identifying control file, check alert log for more info
-
解决:
打开initCCBDB.ora设置
# Define at least two control files by default
control_files = (/home/oracle/db/oradata/ccbdb/control01.ctl,
/home/oracle/db/oradata/ccbdb/control02.ctl,
/home/oracle/db/oradata/ccbdb/control03.ctl)
-
问题:
ORA-00201: control file version 10.2.0.1.0 incompatible with ORACLE version
10.2.0.0.0
ORA-00202: control file: '/home/oracle/db/oradata/ccbdb/control01.ctl'
解决:
打开initCCBDB.ora设置
compatible = 10.2.0.1.0
(sqlplus –version或sqlplus "/as sysdba"进入后可查看当前版本)
再次执行startup,成功!
可能有人会觉得多次改那配置很烦,为什么不一次性弄好再写出来呢,其实这是为了让大家更了解一些问题,所以特意把问题都列出来了。
Oracle就这样成功安装了,接下来是创建表空间和用户,根据自己需要吧!
九.创建表空间和用户
-
查看目前用户情况
1
|
SQL>
select
username
from
dba_users;
|
USERNAME
——————————
MGMT_VIEW
SYS
SYSTEM
DBSNMP
SYSMAN
OUTLN
MDSYS
ORDSYS
EXFSYS
DMSYS
WMSYS
USERNAME
——————————
CTXSYS
ANONYMOUS
XDB
ORDPLUGINS
SI_INFORMTN_SCHEMA
OLAPSYS
SCOTT
TSMSYS
BI
PM
MDDATA
USERNAME
——————————
IX
SH
DIP
OE
HR
27 rows selected.
-
查看目前表空间情况
1
2
3
4
|
SQL>
set
line 120
SQL> col file_name
for
a50
SQL> col tablespace_name
for
a16
SQL>
select
tablespace_name,file_name,bytes/1024/1024
from
dba_data_files;
|
TABLESPACE_NAME | FILE_NAME | BYTES/1024/1024 |
USERS | /home/oracle/db/oradata/ccbdb/users01.dbf | 5 |
SYSAUX | /home/oracle/db/oradata/ccbdb/sysaux01.dbf | 240 |
UNDOTBS1 | /home/oracle/db/oradata/ccbdb/undotbs01.dbf | 30 |
SYSTEM | /home/oracle/db/oradata/ccbdb/system01.dbf | 480 |
EXAMPLE | /home/oracle/db/oradata/ccbdb/example01.dbf | 100 |
-
创建表空间
1
|
SQL>
create
tablespace ccbdbdata datafile
'/home/oracle/db/oradata/ccbdb/ccbdb_data_10g_01'
size
10240m autoextend
off
;
|
Tablespace created.
-
创建用户及授权
1
|
SQL>
create
user
ccbsmg identified
by
ccbsmg
default
tablespace ccbdbdata;
|
User created.
1
|
SQL>
grant
unlimited tablespace
to
ccbsmg;
|
Grant succeeded.
1
|
SQL>
grant
create
session
to
ccbsmg;
|
Grant succeeded.
1
|
SQL>
grant
create
any
table
to
ccbsmg;
|
Grant succeeded.
1
|
SQL>
grant
delete
any
table
to
ccbsmg;
|
Grant succeeded.
1
|
SQL>
grant
create
any
procedure
to
ccbsmg;
|
Grant succeeded.
1
|
SQL>
grant
dba
to
ccbsmg;
|
Grant succeeded.
-
创建索引空间(把索引的表空间与数据表空间分开,也可以不分开)
1
2
|
SQL>
create
tablespace ccbdbidx datafile
'/home/oracle/db/oradata/ccbdb/ccbdb_data_10g_02'
size
10240m autoextend
off
;
|
Tablespace created.
-
查看表空间创建情况
1
|
SQL>
select
tablespace_name,file_name,bytes/1024/1024
from
dba_data_files;
|
TABLESPACE_NAME | FILE_NAME | BYTES/1024/1024 |
USERS | /home/oracle/db/oradata/ccbdb/users01.dbf | 5 |
SYSAUX | /home/oracle/db/oradata/ccbdb/sysaux01.dbf | 240 |
UNDOTBS1 | /home/oracle/db/oradata/ccbdb/undotbs01.dbf | 30 |
SYSTEM | /home/oracle/db/oradata/ccbdb/system01.dbf | 480 |
EXAMPLE | /home/oracle/db/oradata/ccbdb/example01.dbf | 100 |
CCBDBDATA | /home/oracle/db/oradata/ccbdb/ccbdb_data_10g_01 | 10240 |
CCBDBIDX | /home/oracle/db/oradata/ccbdb/ccbdb_data_10g_02 | 10240 |
大功告成!
更多推荐
所有评论(0)