linux下Oracle软件安装和代码创建数据库

更新时间:2023-08-12 19:28:01 阅读量: 初中教育 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

本文档的主要内容是linux下安装Oracle软件时的一些脚本变量,和手工建立数据库的代码

创建组:
groupadd oinstall
groupadd dba
建用户:
useradd -g oinstall -G dba oracle
设置密码:
passwd oracle

更改/u01的用户和用户组
chown -R oracle:oinstall /u01
更改目录/u01/database的操作权限
chmode -R 755 /u01/database

编辑脚本文件:
/etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

# /sbin/sysctl -p --执行生效

/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

/etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

/etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

/etc/csh.login
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif

.bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_LIB
umask 022

#source .bash_profile --执行生效

代码建库:

建目录
cd $ORACLE_BASE
mkdir admin
cd admin
mkdir orcl

mkdir adump bdump cdump udump

cd /u01/
mkdir -p oradata/orcl


建文件
参数文件
initorcl.ora

*.control_files='/u01/oradata/orcl/control01.ctl','/u01/oradata/orcl/control02.ctl','/u01/oradata/orcl/control03.ctl'
*.db_name=orcl
*.db_block_size=8192
*.undo_management=auto
*.undo_tablespace=undotbs
*.sga_target=500M

创建密码文件:
orapwd file=orapworcl password=oracle

create database orcl
user sys identified by oracle
user system identified by oracle
logfile group 1('/u01/oradata/orcl/redo01.log') size 50M,
group 2('/u01/oradata/orcl/redo02.log') size 50M,
group 3('/u01/oradata/orcl/redo03.log') size 50M
maxlogfiles 5
maxlogmembers 5
maxloghistory 1
maxdatafiles 500
maxinstances 1
character set AL32UTF8
national character set UTF8
datafile '/u01/oradata/orcl/system.dbf' size 500M
extent management local
sysaux datafile '/u01/oradata/orcl/sysaux01.dbf' size 500M
default tablespace users
datafile '/u01/oradata/orcl/users01.dbf' size 100M
default temporary tablespace temp
tempfile '/u01/oradata/orcl/temp01.dbf' size 50M
undo tablespace undo
tbs
datafile '/u01/oradata/orcl/undo01.dbf'size 50M;

执行脚本
sql>@?/rdbms/admin/catalog.sql
sql>@?/rdbms/admin/catproc.sql






本文来源:https://www.bwwdw.com/article/mijj.html

Top