[orausr@centos6 ~]$ sqlplus /nolog SQL> conn /as sysdba SQL> startup SQL> show linesize; linesize 80 SQL> set linesize 160; SQL> select * from scott.emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 7839 KING PRESIDENT 17-NOV-81 5000 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- 7900 JAMES CLERK 7698 03-DEC-81 950 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 14 rows selected. SQL> SQL> create user jerry identified by password123; SQL> grant create session to jerry; SQL> conn jerry/password123 SQL> show user;
OEM Web管理(需要先在sqlplus运行startup后才能正常):
:1158/em
三、环境设置脚本
ins-c6-10g.sh
#!/bin/bash
#script for Oracle10g installation on Centos6.6
#Change the following variables for your installation.
local_ip="192.168.122.2"
host_name="centos6"
host_name_fqdn="centos6.localdomain"
oracle_user="orausr"
oracle_user_password="mysql"
oracle_base="/opt/oracle"
oracle_home="/opt/oracle/10.2.1/instance0"
oracle_data="/opt/oracle/data"
oracle_data_recoveryarea="/opt/oracle/data_recover"
oracle_inventory="/opt/oraInventory"
oracle_sid="centos6"
#Change the above variables for your installation.
echo "${local_ip} ${host_name} ${host_name_fqdn}" >>/etc/hosts
groupadd -g 505 dba
groupadd oinstall
groupadd oper
useradd ${oracle_user}
echo ${oracle_user_password}|passwd --stdin ${oracle_user}
usermod -g oinstall -G dba ${oracle_user}
mkdir -p ${oracle_base}
mkdir -p ${oracle_data}
mkdir -p ${oracle_data_recoveryarea}
mkdir -p ${oracle_home}
mkdir -p ${oracle_inventory}
chown -R ${oracle_user}:oinstall ${oracle_base}
chmod -R 755 ${oracle_base}
chmod -R g+s ${oracle_base}
chown -R ${oracle_user}:oinstall ${oracle_inventory}
chmod -R 755 ${oracle_inventory}
chmod -R g+s ${oracle_inventory}
sysctl_value="
kernel.sem = 250 32000 100 128
fs.file-max = 65536
kernel.shmall = 2097152
kernel.shmmax = 1054525444
kernel.shmmni = 4096
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
vm.hugetlb_shm_group = 505
"
/bin/cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo -e "${sysctl_value}" >> /etc/sysctl.conf
sysctl -p
limits_value="
${oracle_user} soft nofile 1024
${oracle_user} hard nofile 65536
${oracle_user} soft nproc 2047
${oracle_user} hard nproc 16384
"
/bin/cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo -e "${limits_value}" >> /etc/security/limits.conf
bash_profile_value="
umask 022
ORACLE_BASE=${oracle_base}
ORACLE_SID=${oracle_sid}
ORACLE_HOME=${oracle_home}
ORACLE_UNQNAME=${oracle_sid}
export ORACLE_BASE ORACLE_SID ORACLE_HOME ORACLE_UNQNAME
PATH=$PATH:${oracle_home}/bin
export PATH
"
/bin/cp /home/${oracle_user}/.bash_profile /home/${oracle_user}/.bash_profile.bak
echo -e "${bash_profile_value}" >> /home/${oracle_user}/.bash_profile
/bin/cp /etc/RedHat-release /root/redhat-release.bak
echo "redhat4" > /etc/redhat-release
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
setenforce 0
sed 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux -i
echo
echo "All prepared! Restart the system and then run Oracle Installer in linux GUI."
四、启动过程示范: