1.修改主机名 和/etc/hosts
2.修改kernel
kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6815744 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 4194304 net.core.rmem_max = 4194304 net.core.wmem_default = 1048576 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576
3.添加组和用户(最好指定gid 和uid)
# groupadd -g 2000 oinstall # groupadd -g 2001 dba # groupadd -g 2002 oper # useradd -u 2000 -g oinstall -G dba,oper oracle # id oracle uid=2000(oracle) gid=2000(oinstall) groups=2000(oinstall),2001(dba),2002(oper)
4.规划目录
产品基目录 ORACLE_BASE /u01/oracle 产品家目录 ORACLE_BASE /u01/oracle/product/ SID ORACLE_SID
5.修改limits
# vim /etc/security/limits.conf
6. centos7 vncserver 配置
参照https://www.cnblogs.com/xiaozhuangAna/articles/9472741.html
# yum -y install tigervnc-server #cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service 编辑vncserver@:1.service里面的<user>为想要启动的用户 #systemctl daemon-reload 第一启动的时候需要切换用户设置vncpasswd 注意的地方: 要注意 view-only 这里要选n 否则会黑屏 #systemctl start vncserver@:1.service 想要开机启动的话 #systemctl enable vncserver@:1.service
pdksh包下载
http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm centos7也是装这个包过的检查
报错Error in invoking target 'agent nmhs' of makefile '/u01/oracle/product/11g/sysman/lib/ins_emagent.mk'
vi $ORACLE_HOME/sysman/lib/ins_emagent.mk 搜索以下行: $(MK_EMAGENT_NMECTL) 改变为: $(MK_EMAGENT_NMECTL) –lnnz11 点击retry
二、建库
执行dbca
连接 SID改成需要连接的数据库的名字然后再执行
sqlplus / as sysdba
解锁scott
alter user scott identified by tiger account unlock;
开机启动
root用户 vim /etc/oratab mydb:/u01/oracle/product/11g:N N改成Y vim /etc/rc.local su - oracle -c ‘dbstart $ORACLE_HOME’
select 语句
select * from tab; select * FROM dept; select * from emp; select * from emp where deptno=10; SELECT * from emp WHERE sal>=3000; SELECT * from emp WHERE ename='SCOTT'; SELECT * FROM emp WHERE SAL>1000 AND job='CLERK'; SELECT * FROM emp where hiredate='23-JAN-82'; SELECT * FROM emp WHERE sal between 2000 AND 3000; select * FROM emp WHERE job in ('CLERK','MANAGER'); --空值 SELECT * FROM emp where comm is null; SELECT * FROM emp where comm is not null; --处理字符串 select * from emp WHERE ename like 'A%'; select * from emp WHERE ename like '_A%'; --查找第二个字符是A的 SELECT * from emp WHERE ename like '_\_%' escape '\'; -- 查找第二个是下划线的 escape设置转义字符 desc emp; select rownum,emp.* from emp; -- rownum 是显示结果集编号 select * from emp where rownum<=5; select * from emp WHERE rownum=2;--错误(没有1哪来的2) select * from (select rownum rn,emp.* from emp) where rn=2;