Chinaunix首页 | 论坛 | 博客
  • 博客访问: 659638
  • 博文数量: 168
  • 博客积分: 2928
  • 博客等级: 中校
  • 技术积分: 1904
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-04 09:56
文章分类

全部博文(168)

文章存档

2010年(168)

我的朋友

分类: Oracle

2010-03-25 11:56:32

tar安装软件,手工创建数据库
一、首先创建先要条件:
1、设置内核参数:
Add the following lines to the /etc/sysctl.conf file:
#kernel.shmall = 2097152
#kernel.shmmax = 2147483648
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
#fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
2、立即生效
Run the following command to change the current kernel parameters:
/sbin/sysctl -p
3、增加安全
Add the following lines to the /etc/security/limits.conf file:
*               soft    nproc   2047
*               hard    nproc   16384
*               soft    nofile  1024
*               hard    nofile  65536
4、登陆权限
Add the following line to the /etc/pam.d/login file, if it does not already exist:
session    required     /lib/security/pam_limits.so
5、关闭防火墙
Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as
follows:
SELINUX=disabled
Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and
Firewall). Click on the SELinux tab and disable the feature.
6、安装需要的包
Setup
Install the following packages:
# From RedHat AS5 Disk 1
cd /media/cdrom/Server
rpm -Uvh setarch-2*
rpm -Uvh make-3*
rpm -Uvh glibc-2*
rpm -Uvh libaio-0*
cd /
eject
# From RedHat AS5 Disk 2
cd /media/cdrom/Server
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh gcc-4*
rpm -Uvh libXp-1*
cd /
eject
# From RedHat AS5 Disk 3
cd /media/cdrom/Server
rpm -Uvh openmotif-2*
rpm -Uvh compat-db-4*
cd /
eject
7、创建用户
Create the new groups and users:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
passwd oracle
8、创建目录
Create the directories in which the Oracle software will be installed:
mkdir -p /u01/app/oracle/product/10.2.0/db_1
chown -R oracle.oinstall /u01
Login as root and issue the following command:
xhost +
Edit the /etc/redhat-release file replacing the current release information (Red Hat Enterprise Linux
Server release 5 (Tikanga)) with the following:
redhat-4
9、设置环境变量
Login as the oracle user and add the following lines at the end of the .bash_profile file:
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=TSH1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi
10、在原服务器打包程序
把$ORACLE_HOME下的东西打包压缩:
 cd $ORACLE_BASE/product
 tar cfz oracle10203.tar 10.2
11、传送到新服务器并解压
 scp 上传
 
cd $ORACLE_BASE/product
 tar -xzf oracle10203
12、经检查,当前的系统确实不存在/opt/ORCLfmap目录,实际上/opt/ORCLfmap是有root.sh生成的,先删除这个软链接:
rm -f /opt/oracle/product/10.2/rdbms/filemap
13、重新执行root.sh:

[root@testserver opt]# /opt/oracle/product/10.2/root.sh
 Running Oracle10 root.sh script...
 
 The following environment variables are set as:
     ORACLE_OWNER= oracle
     ORACLE_HOME=  /opt/oracle/product/10.2
 
 Enter the full pathname of the local bin directory: [/usr/local/bin]:
    Copying dbhome to /usr/local/bin ...
    Copying oraenv to /usr/local/bin ...
    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.
此时软连接和目录都已经存在:

 [root@testserver opt]# ls /opt/oracle/product/10.2/rdbms/filemap
 bin  etc  log
 [root@testserver opt]# ls -l /opt/oracle/product/10.2/rdbms/filemap
 lrwxrwxrwx  1 root root 22 Jan 10 17:40 /opt/oracle/product/10.2/rdbms/filemap -> /opt/ORCLfmap/prot1_64
 
 
二、手工创建数据库
Step 1: Decide on Your Instance Identifier (SID)
Step 2: Establish the Database Administrator Authentication Method
Step 3: Create the Initialization Parameter File
Step 4: Connect to the Instance
Step 5: Create a Server Parameter File (Recommended)
Step 6: Start the Instance
Step 7: Issue the CREATE DATABASE Statement
Step 8: Create Additional Tablespaces
Step 9: Run Scripts to Build Data Dictionary Views
Step 10: Run Scripts to Install Additional Options (Optional)
Step 11: Back Up the Database.
step1 根据文档修改init.ora参数文件:
mynewdb.__db_cache_size=100663296
mynewdb.__java_pool_size=4194304
mynewdb.__large_pool_size=4194304
mynewdb.__shared_pool_size=54525952
mynewdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/mynewdb/adump'
*.background_dump_dest='/u01/app/oracle/admin/mynewdb/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/app/oracle/oradata/mynewdb/control01.ctl','/u01/app/oracle/oradata/mynewdb/c
ontrol02.ctl','/u01/app/oracle/oradata/mynewdb/control03.ctl'
*.core_dump_dest='/u01/app/oracle/admin/mynewdb/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='mynewdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=mynewdbXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1' --说明这里UNDOTBS1这个一定要与创建数据库时的那UNDO要相同,不然的话,就不会创建
成功。
*.user_dump_dest='/u01/app/oracle/admin/mynewdb/udump'
(2)手工创建如下目录:
mkdir -p /u01/app/oracle/admin/mynewdb/adump
mkdir -p /u01/app/oracle/admin/mynewdb/bdump
mkdir -p /u01/app/oracle/admin/mynewdb/cdump
mkdir -p /u01/app/oracle/admin/mynewdb/dpdump
mkdir -p /u01/app/oracle/admin/mynewdb/pfile
mkdir -p /u01/app/oracle/admin/mynewdb/udump
mkdir -p /u01/app/oracle/flash_recovery_area
 
step2创建密码文件
orapwd file=/u01/app/oracle/product/10.2.0/db_1/orapwd_mynewdb1 password=oracle

step4---登陆oracle:
> sqlplus “/ as sysdba”
step5--创建spfile
create spfile='/u01/app/oracle/product/10.2.0/db_1/dbs/spfilemynewdb.ora' from
pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/initmynewdb.ora';
step6---启动实例:
SQL> startup nomount pfile=/opt/oracle/admin/dbtest/pfile/init.ora

step7---创建数据库的脚本:
CREATE DATABASE mynewdb
LOGFILE
GROUP 1 ('/u01/oradata/mynewdb/redo01.log','/u01/oradata/mynewdb/redo01_1.log') size 10m reuse,
GROUP 2 ('/u01/oradata/mynewdb/redo02.log','/u01/oradata/mynewdb/redo02_1.log') size 10m reuse,
GROUP 3 ('/u01/oradata/mynewdb/redo03.log','/u01/oradata/mynewdb/redo03_1.log') size 10m reuse
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXLOGHISTORY 200
MAXDATAFILES 500
MAXINSTANCES 5
ARCHIVELOG
CHARACTER SET UTF8
NATIONAL CHARACTER SET UTF8
DATAFILE '/u01/oradata/mynewdb/system01.dbf' SIZE 100M EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/oradata/mynewdb/sysaux01.dbf' SIZE 100M
UNDO TABLESPACE UNDOTBS1 DATAFILE '/u01/oradata/mynewdb/undo.dbf' SIZE 200M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/u01/oradata/mynewdb/temp.dbf' SIZE 20M ---说明这个TEMP一定要写
成TEMP才能成功
 

step8 ---创建一些附加的表空间
CREATE TABLESPACE users LOGGING
     DATAFILE '/u01/oradata/mynewdb/users01.dbf'
     SIZE 25M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
     EXTENT MANAGEMENT LOCAL;
CREATE TABLESPACE indx LOGGING
     DATAFILE '/u01/oradata/mynewdb/indx01.dbf'
     SIZE 25M REUSE AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
     EXTENT MANAGEMENT LOCAL;
step 9---创建数据字典
CONNECT SYS/password AS SYSDBA
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catalog.sql
@/u01/app/oracle/product/10.2.0/db_1/rdbms/admin/catproc.sql
EXIT
step 10 运行其他脚本:
step 11 备份数据库。
 
阅读(2075) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~