ORACLE³£ÓÃÃüÁî
ORACLE³£ÓÃÃüÁî
Ò»¡¢ORACLEµÄÆô¶¯ºÍ¹Ø±Õ
1¡¢ÔÚµ¥»ú»·¾³ÏÂ
ÒªÏëÆô¶¯»ò¹Ø±ÕORACLEϵͳ±ØÐëÊ×ÏÈÇл»µ½ORACLEÓû§£¬ÈçÏÂ
su - oracle
a¡¢Æô¶¯ORACLEϵͳ
oracle>svrmgrl
SVRMGR>connect internal
SVRMGR>startup
SVRMGR>quit
b¡¢¹Ø±ÕORACLEϵͳ
oracle>svrmgrl
SVRMGR>connect internal
SVRMGR>shutdown
SVRMGR>quit
Æô¶¯oracle9iÊý¾Ý¿âÃüÁ
$ sqlplus /nolog
SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 13:53:53 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup^C
SQL> startup
ORACLE instance started.
2¡¢ÔÚË«»ú»·¾³ÏÂ
ÒªÏëÆô¶¯»ò¹Ø±ÕORACLEϵͳ±ØÐëÊ×ÏÈÇл»µ½rootÓû§£¬ÈçÏÂ
su £ root
a¡¢Æô¶¯ORACLE ϵͳ
hareg £y oracle
b¡¢¹Ø±ÕORACLEϵͳ
hareg £n oracle
Oracle Êý¾Ý¿âÓÐÄļ¸ÖÖÆô¶¯·½Ê½
˵Ã÷£º
ÓÐÒÔϼ¸ÖÖÆô¶¯·½Ê½£º
1¡¢startup nomount
·Ç°²×°Æô¶¯£¬ÕâÖÖ·½Ê½Æô¶¯Ï¿ÉÖ´ÐУºÖؽ¨¿ØÖÆÎļþ¡¢Öؽ¨Êý¾Ý¿â
¶ÁÈ¡init.oraÎļþ£¬Æô¶¯instance£¬¼´Æô¶¯SGAºÍºǫ́½ø³Ì£¬ÕâÖÖÆô¶¯Ö»ÐèÒªinit.oraÎļþ¡£
2¡¢startup mount dbname
°²×°Æô¶¯£¬ÕâÖÖ·½Ê½Æô¶¯Ï¿ÉÖ´ÐУº
Êý¾Ý¿âÈÕÖ¾¹éµµ¡¢
Êý¾Ý¿â½éÖʻָ´¡¢
ʹÊý¾ÝÎļþÁª»ú»òÍÑ»ú£¬
ÖØж¨Î»Êý¾ÝÎļþ¡¢ÖØ×öÈÕÖ¾Îļþ¡£
Ö´ÐÐ “nomount”£¬È»ºó´ò¿ª¿ØÖÆÎļþ£¬È·ÈÏÊý¾ÝÎļþºÍÁª»úÈÕÖ¾ÎļþµÄλÖã¬
µ«´Ëʱ²»¶ÔÊý¾ÝÎļþºÍÈÕÖ¾Îļþ½øÐÐУÑé¼ì²é¡£
3¡¢ startup open dbname
ÏÈÖ´ÐГnomount”£¬È»ºóÖ´ÐГmount”£¬ÔÙ´ò¿ª°üÀ¨Redo logÎļþÔÚÄÚµÄËùÓÐÊý¾Ý¿âÎļþ£¬
ÕâÖÖ·½Ê½Ï¿ɷÃÎÊÊý¾Ý¿âÖеÄÊý¾Ý¡£
4¡¢startup£¬µÈÓÚÒÔÏÂÈý¸öÃüÁî
startup nomount
alter database mount
alter database open
5¡¢ startup restrict
Ô¼Êø·½Ê½Æô¶¯
ÕâÖÖ·½Ê½Äܹ»Æô¶¯Êý¾Ý¿â£¬µ«Ö»ÔÊÐí¾ßÓÐÒ»¶¨ÌØȨµÄÓû§·ÃÎÊ
·ÇÌØȨÓû§·ÃÎÊʱ£¬»á³öÏÖÒÔÏÂÌáʾ£º
ERROR£º
ORA-01035: ORACLE Ö»ÔÊÐí¾ßÓÐ RESTRICTED SESSION ȨÏÞµÄÓû§Ê¹ÓÃ
6¡¢ startup force
Ç¿ÖÆÆô¶¯·½Ê½
µ±²»ÄܹرÕÊý¾Ý¿âʱ£¬¿ÉÒÔÓÃstartup forceÀ´Íê³ÉÊý¾Ý¿âµÄ¹Ø±Õ
ÏȹرÕÊý¾Ý¿â£¬ÔÙÖ´ÐÐÕý³£Æô¶¯Êý¾Ý¿âÃüÁî
7¡¢startup pfile=²ÎÊýÎļþÃû
´ø³õʼ»¯²ÎÊýÎļþµÄÆô¶¯·½Ê½
ÏȶÁÈ¡²ÎÊýÎļþ£¬ÔÙ°´²ÎÊýÎļþÖеÄÉèÖÃÆô¶¯Êý¾Ý¿â
Àý£ºstartup
Ïà¹ØÎĵµ£º
empÔ±¹¤±í
(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
------1.Ñ¡Ôñ²¿ÃÅ30ÖеÄËùÓÐÔ±¹¤.
select ename
from emp
where deptno = 30;
------2.ÁгöËùÓаìÊÂÔ±(CLERK)µÄÐÕÃû£¬±àºÅºÍ²¿ÃűàºÅ.
select ename,empno,deptno
from emp
where job='CLERK';
--- ......
×î½ü×öÁËÒ»¸öÊý¾ÝÕï¶ÏµÄÏîÄ¿£¬ÀïÃæ×Ô¼ºÐ´ÁËÒ»¸öÊý¾Ý¿âµÄ²Ù×÷À࣬°üº¬£ºÁ¬½ÓÊý¾Ý¿â¡¢¶ÁÊý¾Ý±í¡¢Ö´ÐÐSQL²Ù×÷£¬ÊÍ·ÅÊý¾Ý¿âµÈ×é³É£¬Ï£Íû¶Ô´ó¼ÒÓÐÓã¬ÓÉÓÚˮƽÓÐÏÞ£¬ÈôÓдíÎó»òÕß´úÂë²»×ãµØ·½»¶ÓÖ¸Õý£¬Ð»Ð»¡£
ADOOperate.H
//////////////////////////////////////////////////////////////////////
// ......
OracleÖÐÖ»¸üÐÂÁ½Õűí¶ÔÓ¦Êý¾ÝµÄ·½·¨
ÏȽ¨Á¢Ò»¸ö½á¹¹Ò»Ä£Ò»ÑùµÄ±íemp1£¬²¢ÎªÆä²åÈ벿·ÖÊý¾Ý
create table emp1
as
select * from emp where deptno = 20;
updateµôemp1ÖеIJ¿·ÖÊý¾Ý
update emp1
set sal = sal + 100,
comm = nvl(comm,0) + 50
È»ºóÎÒÃÇÊÔ×ÅʹÓÃemp1ÖÐÊý¾ÝÀ´¸üÐÂempÖÐsal ºÍ commÕâÁ½ÁÐÊý¾Ý¡£
ÎÒÃ ......
ORACLEÈçºÎÍ£Ö¹Ò»¸öJOB
1 Ïà¹Ø±í¡¢ÊÓͼ
2 ÎÊÌâÃèÊö
Ϊͬʽâ¾öÒ»¸öÒòΪÍøÂçÁ¬½ÓÇé¿ö²»¼Ñʱ£¬Ö´ÐÐÒ»¸ö³¬³¤Ê±¼äµÄSQL²åÈë²Ù×÷¡£
¼ÈÈ»ÍøÂç×´¿ö²»ºÃ£¬¾ÍÑ¡ÔñÁËʹÓÃÒ»´ÎÐÔʹÓÃJOBÀ´Íê³É¸Ã²åÈë²Ù×÷¡£ÔÚJOBÖ´ÐÐÒ»¶Îʱ¼äºó£¬ÎÒ·¢ÏÖ±»²åÈë±íÓÐЩÎÊÌ⣨²ÑÀ¢£¬µ±Ê±Ò²Ã»ÓÐÏȼì²é¼ì²é¾Í×öÁË£©¡£×¼±¸Í£Ö¹JOB£¬ÒòΪÔÚJOBÔËÐÐÇé¿öÏ£¬ÎÒ ......