赞
踩
环境:
redhat7
版本 11.2.0.4
[root@localhost software]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are
protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost software]# firewall-cmd --state #查看防火
墙状态
running
[root@localhost software]# systemctl stop firewalld.service #停止防
火墙
[root@localhost software]# systemctl disable firewalld.service #禁止开
机启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@iZ28ubyqhl0Z ~]# groupadd oinstall
[root@iZ28ubyqhl0Z ~]# groupadd dba
[root@iZ28ubyqhl0Z home]# useradd -g oinstall -G dba oracle
[root@iZ28ubyqhl0Z home]# passwd oracle
[root@iZ28ubyqhl0Z home]# vi /etc/sysctl.conf fs.file-max=6815744 fs.aio-max-nr=104857600 kernel.sem=4096 524288 4096 128 kernel.shmmni=4096 kernel.shmall=4294967296 #核心参数,shmall=shmmax/1024 kernel.shmmax=4398046511104 #核心参数,Linux进程可以分配的单独共享内存段的最大值。一般 设置为内存总大小的一半。 #一般为:物理内存/2 * 1024 * 1024 * 1024 #最大为:物理内存*1024*1024*1024-1 net.core.rmem_default=262144 net.core.rmem_max=4194304 net.core.wmem_default=262144 net.core.wmem_max=1048576 net.ipv4.ip_local_port_range=9000 65500 net.ipv4.icmp_echo_ignore_broadcasts=1 net.ipv4.icmp_ignore_bogus_error_responses=1 net.ipv4.tcp_syncookies=1 [root@bogon ~]# sysctl -p #重启生效内核参数 [root@iZ28ubyqhl0Z home]# vi /etc/security/limits.conf oracle soft nproc 65536 oracle hard nproc 65536 oracle soft nofile 65536 oracle hard nofile 65536 oracle hard memlock unlimited oracle soft memlock unlimited oracle soft stack 65536 oracle hard stack 65536
[root@iZ28ubyqhl0Z home]# vi /etc/pam.d/login
#末尾添加
session required /lib64/security/pam_limits.so
session required pam_limits.so
[root@iZ28ubyqhl0Z home]# vi /etc/profile
#oracle配置 添加
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[root@iZ28ubyqhl0Z home]# source /etc/profile
[root@iZ28ubyqhl0Z ~]# mkdir -p /u01/app/oracle
[root@iZ28ubyqhl0Z ~]# chown -R oracle:oinstall /u01
[root@iZ28ubyqhl0Z ~]# chmod -R 775 /u01
[root@iZ28ubyqhl0Z ~]# mkdir -p /data/orcl
[root@iZ28ubyqhl0Z ~]# chown -R oracle:oinstall /data
[root@iZ28ubyqhl0Z ~]# chmod -R 775 /data
[root@iZ28ubyqhl0Z ~]# mkdir -p /arch/backdata/rman
[root@iZ28ubyqhl0Z ~]# chown -R oracle:oinstall /arch
[root@iZ28ubyqhl0Z ~]# chmod -R 775 /arch
[root@iZ28ubyqhl0Z /]# echo 'multilib_policy=all' >> /etc/yum.conf
[root@iZ28ubyqhl0Z /]# yum install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel glibc-common glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel libgomp compat-libstdc++-33 glibc compat-libcap1 compat-gcc-34 glibc-devel libstdc++ dstat elfutils-libelf-devel-static
[root@iZ28ubyqhl0Z /]# yum install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
[root@iZ28ubyqhl0Z /]# yum install compat-libstdc++-33
[root@iZ28ubyqhl0Z home]# su - oracle
[oracle@iZ28ubyqhl0Z home]$ vi .bash_profile
# 添加在最后一行export PATH的前面
umask 022
export LANG=en_US
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export NLS_LANG=american_america.zhs16gbk
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@iZ28ubyqhl0Z ~] $ source .bash_profile
[oracle@iZ28ubyqhl0Z ~] $ su - root
#安装桌面
[root@iZ28ubyqhl0Z ~]# yum -y groupinstall “GNOME”
#安装VNC
[root@iZ28ubyqhl0Z ~]# yum -y install tigervnc tigervnc-server
[root@iZ28ubyqhl0Z ~]# cd /etc/sysconfig
[root@iZ28ubyqhl0Z ~]# vi vncservers
VNCSERVERS="1:oracle"
VNCSERVERARGS[1]="-geometry 1024x768"
[root@iZ28ubyqhl0Z ~]# su - oracle
[root@iZ28ubyqhl0Z ~]# vncserver
下载地址为 https://www.realvnc.com/en/connect/download/viewer/ ,下载完成后点击file -> new
connnetion 进行连接服务器,VNC Server:IP:5091
安装介质如有需要可私信分享百度网盘
上传到/u01/app/oracle目录下,在vnc桌面命令行下进行解压,安装unzip(yum install unzip),解压
在/u01/app/oracle目录下(vnc桌面上的命令行进行安装)
[root@localhost oracle]# cd /u01/app/oracle
[root@localhost oracle]# unzip p13390677_112040_Linux-x86-64_1of7.zip
[root@localhost oracle]# unzip p13390677_112040_Linux-x86-64_2of7.zip
#安装jdk环境
[oracle@iZ28ubyqhl0Z ~]# yum -y install openjdk-1.8.0*
[oracle@iZ28ubyqhl0Z ~]# cd /u01/app/oracle/database
[oracle@iZ28ubyqhl0Z database]$ ./runInstaller -jreLoc /etc/alternatives/jre_1.8.0
如果在86%出现以上错误,则进行以下配置后再retry
解决方案 在makefile中添加链接libnnz11库的参数 修改
$ORACLE_HOME/sysman/lib/ins_emagent.mk,将 $(MK_EMAGENT_NMECTL)修改为:
$(MK_EMAGENT_NMECTL) -lnnz11 建议修改前备份原始文件 [oracle@ysserver ~]$ cd
$ORACLE_HOME/sysman/lib [oracle@ysserver lib]$ cp ins_emagent.mk ins_emagent.mk.bak
[oracle@ysserver lib]$ vi ins_emagent.mk
进入vi编辑器后 命令模式输入/NMECTL 进行查找,快速定位要修改的行 在后面追加参数-lnnz11 第一个是字母l 后面两个是数字1
保存退出后Retry (如果看不到以上弹框,则在键盘上按左箭头后直接enter)
下图中弹框有时候会比较小,可以直接拉动放大
不执行 需要root的用户下依次执行以上的脚本
[root@iZ28ubyqhl0Z ~]#sh /u01/app/oraInventory/orainstRoot.sh Changing permissions of /app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /app/oraInventory to oinstall. The execution of the script is complete. [root@iZ28ubyqhl0Z ~]#sh /u01/app/oracle/product/11.2.0/dbhome_1/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /app/oracle/product/11.2.0.3/db_1 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 script. Now product-specific root actions will be performed. Finished product-specific root actions.
执行完成后点击 OK
[oracle@iZ28ubyqhl0Z ~]$ netca
[oracle@iZ28ubyqhl0Z ~]$ dbca
[root@bogon oracle]# su - root
[root@bogon oracle]# cd /etc/security/limits.d/
[root@bogon oracle]#ls
[root@bogon oracle]# vim 20-nproc.conf
#* soft nproc 4096
[oracle@iZ28ubyqhl0Z ~]$ ps -aef|grep vnc
oracle 2153 1 0 16:19 pts/1 00:00:18 /usr/bin/Xvnc :1 -desktop
iZ28ubyqhl0Z:1 (oracle) -auth /home/oracle/.Xauthority -geometry 1024x768 -
rfbwait 30000 -rfbauth /home/oracle/.vnc/passwd -rfbport 5901 -fp
catalogue:/etc/X11/fontpath.d -pn
oracle 2161 2160 0 16:19 pts/1 00:00:00 vncconfig -iconic
oracle 5952 5868 0 17:49 pts/3 00:00:00 grep vnc
[oracle@iZ28ubyqhl0Z ~]$ vncserver -kill :1
# 设置开机不自启
[root@iZ28ubyqhl0Z ~]# chkconfig --list vncserver
vncserver 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[oracle@iZ28ubyqhl0Z ~]$ lsnrctl status
#连接数据库
[oracle@app1 ~]$ sqlplus / as sysdba
#查看用户的proifle是哪个,一般是default:
sql>Select username,PROFILE FROM dba_users;
#查看指定概要文件(如default)的密码有效期设置:
sql> Select * FROM dba_profiles s Where s.PROFILE='DEFAULT' AND RESOURCE_NAME='PASSWORD_LIFE_TIME';
#将密码有效期由默认的180天修改成“无限制”,无需重启,修改后即生效
sql>Alter PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
(1) 先以root身份登录到linux系统
(2) 键入命令“vi /etc/oratab”(使用vi编辑器编辑文件/etc/oratab)
(3) 进入vi编辑器后,找到“orcl:/u01/app/oracle/product/12.1.0/dbhome_1:N”,改为
“orcl:/u01/app/oracle/product/12.1.0/dbhome_1:Y”。修改完成后,保存退出vi。
说明:orcl为实例名;/u01/app/oracle/product/12.1.0/dbhome_1为oracle安装目录;会因安装的情况不同而有所不同。
(4) 键入命令“ vi /etc/rc.d/rc.local ”
(5) 在vi编辑器中,添加:
说明:/u01/app/oracle/product/11.2.0/dbhome_1为oracle的安装目录,要根据实际情况进行修改。
su oracle -lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
(6)添加可执行权限
chmod +x /etc/rc.d/rc.local
create user test identified by test;
alter user test identified by 123456;
drop user test;
drop user test cascade;
oracle为兼容以前版本,提供三种标准角色(role):connect/resource和dba.
临时用户,特指不需要建表的用户,通常只赋予他们connect role.
connect是使用oracle简单权限,这种权限只对其他用户的表有访问权限,包括select/insert/update和delete等。
拥有connect role 的用户还能够创建表、视图、序列(sequence)、簇(cluster)、同义词(synonym)、回话(session)和其他 数据的链(link)
更可靠和正式的数据库用户可以授予resource role。
resource提供给用户另外的权限以创建他们自己的表、序列、过程(procedure)、触发器(trigger)、索引(index)和簇(cluster)。
dba role拥有所有的系统权限
包括无限制的空间限额和给其他用户授予各种权限的能力。system由dba用户拥有
grant connect, resource, dba to test;
revoke connect, resource, dba from test;
#!/bin/bash #这个是rman全备shell脚本 #定义全局变量ORACLE_SID、ORACLE_HOME、ORACLE_BASE、NLS_LANG export ORACLE_SID=orcl export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_BASE=/u01/app/oracle export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" #定义变量backuptime,用于保存备份文件和备份日志 backuptime=`date +"20%y%m%d%H%M%S"` backup_dir=/arch/backdata/rman/$backuptime if [[ ! -e "$backup_dir" ]] then mkdir -p $backup_dir touch $backup_dir/log chown -R oracle:oinstall $backup_dir chmod -R 775 $backup_dir fi su - oracle 1>$backup_dir/log 2>&1 <<EOF cd $ORACLE_HOME/bin rman target / run{ allocate channel c1 device type disk; allocate channel c2 device type disk; allocate channel c3 device type disk; crosscheck backup; sql 'alter system archive log current'; backup database format '$backup_dir/db_%d_%T_%U'; sql 'alter system archive log current'; backup archivelog all format '$backup_dir/arc_%t_%s' delete all input; backup spfile format '$backup_dir/spfile_%d_%T_%u'; backup current controlfile format '$backup_dir/cntrl_%s_%p_%s'; crosscheck archivelog all completed before 'sysdate-7'; #删除7天前生成的所有归 档。 #delete noprompt expired backup; delete noprompt obsolete; #delete noprompt backup of database completed before 'sysdate - 7'; #删除30 天内备份 release channel c1; release channel c2; release channel c3; } EOF
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。