



免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
登录数据库 sqlplus username/passwordORACLE_SID(环境变量) 数据库对应的实例的名字,该名字决定了连接哪个具体的数据库show user 查看当前用户desc tablename 查看表结构 desc describe的缩写查询员工的姓名,和工资select first_name,salary from s_emp;查询员工的名字和职位select first_name,title from s_emp;edit 修改sql语句 l 查看 /运行select * from s_dept; 列出部门表的所有信息列出每个员工的年薪select first_name,salary*12 from s_emp;列出每个员工的总收入select first_name,salary*12*(1+commission_pct/100) tol sal from s_emp;空值会导致算术表达式为空,Oracle认为null为无穷大select first_name,salary*12*(1+nvl(commission_pct,0)/100) tol_sal,Commission_pctfrom s_empnvl(p1,p2)if(p1 is null) then return p2;else return p1;coalesce 和nvl实现的是同样的功能,nvl只能用在Oracle,coalesce可以用在多种数据库,nvl的两个参数的类型必须一致继续试验:oracleoel501 $ orapw file=$ORACLE_HOME/dbs/orapwRAC password=zzzz entries=5 force=yoracleoel501 $ cat init.ora |grep -v # initRAC1.ora;oracleoel501 $ vi initRAC1.ora*.compatible=11.2.0*.control_files=+DATA/RAC/CONTROLFILE/control00.ctl*.db_block_size=8192*.db_name=RAC*.open_cursors=300*.pga_aggregate_target=120M*.processes=150*.remote_login_passwordfile=EXCLUSIVE*.sga_target=256Moracleoel501 $ sqlplus / as sysdbaSQL startup nomount;SQL create spfile=+DATA/RAC/SPFILE/spfileRAC.ora from pfile;SQL shutdown abort;oracleoel501 $ vi initRAC1.oraspfile=+DATA/RAC/SPFILE/spfileRAC.oraoracleoel501 $ sqlplus / as sysdbaSQL startup nomountSQL CREATE DATABASE RAC 2 USER SYS IDENTIFIED BY zzzz 3 USER SYSTEM IDENTIFIED BY zzzz 4 LOGFILE 5 GROUP 1 (+DATA/RAC/ONLINELOG/redo1_01.rdo) SIZE 25M BLOCKSIZE 512, 6 GROUP 2 (+DATA/RAC/ONLINELOG/redo1_02.rdo) SIZE 25M BLOCKSIZE 512 7 MAXLOGFILES 5 8 MAXLOGMEMBERS 5 9 MAXLOGHISTORY 110 MAXDATAFILES 10011 CHARACTER SET AL32UTF812 NATIONAL CHARACTER SET AL16UTF1613 EXTENT MANAGEMENT LOCAL14 DATAFILE +DATA/RAC/DATAFILE/system00.dbf SIZE 700M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED15 SYSAUX DATAFILE +DATA/RAC/DATAFILE/sysaux00.dbf SIZE 700M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED16 DEFAULT TEMPORARY TABLESPACE tempts117 TEMPFILE +DATA/RAC/TEMPFILE/temp01.dbf SIZE 20M REUSE18 UNDO TABLESPACE undotbs119 DATAFILE +DATA/RAC/DATAFILE/undotbs1_01.dbf20 SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;Database created.oracleoel501 $ srvctl add database -d RAC -o /opt/oracle/app/oracle/product/11.2.0/dbhome_1 -c RAC -p +DATA/RAC/spfile/spfileRAC.oraoracleoel501 $ srvctl add instance -d RAC -i RAC1 -n oel501oracleoel501 $ srvctl add instance -d RAC -i RAC2 -n oel502gridoel501 $ srvctlstop instance -d RAC -n oel501gridoel501 $ srvctl start instance -d RAC -n oel501gridoel501 $ srvctl stop instance -d RAC -n oel502gridoel501 $ srvctl start instance -d RAC -n oel502PRCR-1013 : Failed to start resource ora.rac.dbPRCR-1064 : Failed to start resource ora.rac.db on node oel502CRS-2546: Server oel502 is not onlineoracleoel501 $ sqlplus / as sysdbaSQL ?/rdbms/admin/catalog SQL ?/rdbms/admin/catproc.等一段时间SQL alter system set undo_tablespace=undotbs1 scope=spfile sid=RAC1;SQL alter system set undo_tablespace=undotbs2 scope=spfile sid=RAC2;SQL alter database add logfile instance RAC2 group 3 +DATA/rac/onlinelog/redo2_01.rdo size 25MSQL alter database add logfile instance RAC2 group 4 +DATA/rac/onlinelog/redo2_02.rdo size 25MSQL alter database enable thread 2;SQL shutdown immediate;rootoel502 #/opt/grid/app//grid/crs/install/roothas.pl -verbose -deconfig -force rootoel502 # /opt/grid/app//grid/root.shoracleoel502 $ sqlplus / as sysdbaSQL startup.Database opened.gridoel501 $ srvctl start instance -d rac -n oel501PRCR-1013 : Failed to start resource ora.rac.dbPRCR-1064 : Failed to start resource ora.rac.db on node oel501CRS-5017: The resource action ora.rac.db start encountered the following error: ORA-01034: ORACLE not availableORA-27101: shared memory realm does not existLinux-x86_64 Error: 2: No such file or directoryProcess ID: 0Session ID: 0 Serial number: 0. For details refer to (:CLSN00107:) in /opt/grid/app/11.2.0/grid/log/oel501/agent/crsd/oraagent_oracle/oraagent_oracle.log.CRS-2674: Start of ora.rac.db on oel501 failed$DIAG_INFO/rdbms/trace/alertlog: USER (ospid: 22841): terminating the instance due to error 304gridoel501 $ oerr ora 30400304, 00000, requested INSTANCE_NUMBER is busy/ *Cause: An instance tried to start by using a value of the/ initialization parameter INSTANCE_NUMBER that is already in use./ *Action: Either/ a) specify another INSTANCE_NUMBER,/ b) shut down the running instance with this number/ c) wait for instance recovery to complete on the instance with/ this number.oracleoel502 $ sqlplus / as sysdbaSQL show parameter instance_numberNAME TYPE VALUE- - -instance_number integer 0SQL alter system set instance_number=2 scope=spfile sid=RAC2;SQL shutdown immediateoracleoel501 $ sqlplus / as sysdbaSQL startup nomountSQL show parameter instance_numberNAME TYPE VALUE- - -instance_number integer 0SQL alter system set instance_number=1 scope=spfile sid=RAC1;SQL shutdown immediategridoel502 $ srvctl start instance -d rac -n oel502PRCR-1013 : Failed to start resource ora.rac.dbPRCR-1064 : Failed to start resource ora.rac.db on node oel502CRS-5017: The resource action ora.rac.db start encountered the following error: ORA-01102: cannot mount database in EXCLUSIVE mode. For details refer to (:CLSN00107:) in /opt/grid/app/11.2.0/grid/log/oel502/agent/crsd/oraagent_oracle/oraagent_oracle.log.CRS-2674: Start of ora.rac.db on oel502 failed$DIAG_INFO/rdbms/trace/alertlog: USER (ospid: 8609): terminating the instance due to error 1102gridoel502 $ oerr o
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 农发行德阳市旌阳区2025秋招笔试英语题专练及答案
- 工业基础电工讲解课件
- 2025年环保产业绿色技术创新与政策环境分析报告
- 2025年新能源行业供应链风险预警与应对策略研究报告
- 农发行吐鲁番市高昌区2025秋招金融科技岗笔试题及答案
- 2025年新能源行业企业数字化转型中新能源企业品牌建设业务流程再造报告
- 测试工程师面试题及答案解析
- 夜间施工安全教育培训课件
- 美容师初级实操考试题
- 乳制品生产规程培训考试试题
- 部编版小学一年级上册语文带拼音阅读练习题26篇
- 无机及分析化学第2章-化学热力学基础1
- GB/T 2930.1-2017草种子检验规程扦样
- 会计学原理模拟试题一套
- 第一章-宗教社会学的发展和主要理论范式课件
- 国内外新能源现状及发展趋势课件
- 临床常见护理技术操作常见并发症的预防与处理课件
- 高速公路改扩建桥梁拼宽施工技术及质量控制
- 双台110kV主变短路电流计算书
- 你不懂咖啡课件
- 危险物品储存安全隐患排查整治表
评论
0/150
提交评论