Oracleϵͳ¹ÜÀíºÍϵͳ×ÊÁÏ»ñÈ¡µÄһЩ»ù±¾ÃüÁî
×ÊÁÏ»ñÈ¡×ÔѧϰºÎÃ÷Öø×÷<<Oracle DBA Åàѵ½Ì³Ì>>µÚ¶þ°æÖ®Ê±.ÆäÖÐdba_¿ªÍ·µÄ±íÐèÒªÓÐsysdbaȨÏÞ²ÅÄÜ·ÃÎÊ.
1. »ñÈ¡Êý¾Ý¿âÃû×Ö,´´½¨ÈÕÆÚ,µ±Ç°Ä£Ê½,ÈÕ־ģʽµÈµÈ:
SELECT name,created,log_mode,open_mode from v$database;
2. »ñÈ¡ÔËÐÐʵÀýµÄÖ÷»úÃû,ʵÀýÃû,°æ±¾:
SELECT host_name,instance_name,version from v$instance;
3. »ñÈ¡×é¼þ°æ±¾ÐÅÏ¢.
SELECT * from v$version;
4.»ñÈ¡¿ØÖÆÎļþÐÅÏ¢.
SELECT * from v$controlfile;
5.»ñÈ¡ÈÕÖ¾ÎļþÐÅÏ¢.
SELECT * from v$logfile;
ºÍ
SELECT group#, members, bytes, status, archived from v$log;
6. »ñÈ¡±¸·ÝºÍ»Ö¸´²ßÂÔ,ÒÔ¼°¹éµµÎļþλÖÃ.(Ò²ÐèÒªsysdbaȨÏÞ)
archived log list
7. Èç¹ûÉÏÃæÊä³öÖеĴ浵ÖÕµãµÄÖµ²»ÊÇÖ±½ÓµÄĿ¼¶øÊÇ USE_DB_RECOVERY_FILE_DEST µÄ»°,ÓÃÒÔÏÂÓï¾ä»ñÈ¡×îÖÕÐÅÏ¢.
SELECT name,value from v$parameter WHERE name = 'db_recovery_file_dest';
8.»ñÈ¡±í¿Õ¼äÐÅÏ¢.
SELECT tablespace_name, block_size, status, contents, logging from dba_tablespaces;
9. »ñÈ¡Êý¾ÝÎļþÐÅÏ¢.
SELECT file_id, file_name, tablespace_name, status, bytes from dba_data_files;
10. ÔÚûÓÐsysdbaȨÏÞʱ,¿ÉÒÔÓÃÒÔÏÂÓï¾äÀ´»ñÈ¡Êý¾ÝÎļþµÄ´¢´æÎ»ÖÃÐÅÏ¢.
SELECT name from v$datafile;
11. »ñÈ¡Óû§ÐÅÏ¢.
SELECT username,created from dba_users;
Ïà¹ØÎĵµ£º
select * from sys.smon_scn_time;
--scn Óëʱ¼äµÄ¶ÔÓ¦¹ØÏµ
ÿ¸ô5·ÖÖÓ£¬ÏµÍ³²úÉúÒ»´Îϵͳʱ¼ä±ê¼ÇÓëscnµÄÆ¥Åä²¢´æÈësys.smon_scn_time±í¡£
select * from student as of scn 592258
¾Í¿ÉÒÔ¿´µ½ÔÚÕâ¸ö¼ì²éµãµÄ±íµÄÀúÊ·Çé¿ö¡£
È»ºóÎÒÃǻָ´µ½Õâ¸ö¼ì²éµã
insert into student select * from student a ......
ÊÕ¼¯µÄ¼¸ÌõÔÚoracleÖÐͨ¹ýconnect by priorÀ´ÊµÏֵݹé²éѯ
Start with...Connect By×Ó¾äµÝ¹é²éѯһ°ãÓÃÓÚÒ»¸ö±íά»¤Ê÷ÐνṹµÄÓ¦Óá£
´´½¨Ê¾Àý±í£º
CREATE TABLE TBL_TEST
(
ID NUMBER,
NAME VARCHAR2(100 BYTE),
PID NUMBER ......
¡¡¡¡decode()º¯ÊýÊÇORACLE PL/SQLÊǹ¦ÄÜÇ¿´óµÄº¯ÊýÖ®Ò»£¬Ä¿Ç°»¹Ö»ÓÐORACLE¹«Ë¾µÄSQLÌṩÁ˴˺¯Êý£¬ÆäËûÊý¾Ý¿â³§É̵ÄSQLʵÏÖ»¹Ã»Óд˹¦ÄÜ¡£
DECODEº¯ÊýÊÇORACLE PL/SQLÊǹ¦ÄÜÇ¿´óµÄº¯ÊýÖ®Ò»£¬Ä¿Ç°»¹Ö»ÓÐORACLE¹«Ë¾µÄSQLÌṩÁ˴˺¯Êý£¬ÆäËûÊý¾Ý¿â³§É̵ÄSQLʵÏÖ»¹Ã»Óд˹¦ÄÜ¡£DECODEÓÐÊ²Ã´Ó ......
ÊÂÎñ¾ÍÊDZ»°ó¶¨ÔÚÒ»Æð×÷Ϊһ¸öÂß¼¹¤×÷µ¥ÔªµÄSQLÓï¾ä·Ö×飬Èç¹ûÈκÎÒ»¸öÓï¾ä²Ù×÷ʧ°ÜÄÇôÕû¸ö²Ù×÷¾Í±»Ê§°Ü£¬ÒÔºó²Ù×÷¾Í»á»Ø¹öµ½²Ù×÷ǰ״̬£¬»òÕßÊÇÉÏÓиö½Úµã¡£ÎªÁËÈ·±£ÒªÃ´Ö´ÐУ¬ÒªÃ´²»Ö´ÐУ¬¾Í¿ÉÒÔʹÓÃÊÂÎñ¡£ÊÂÎñÓÐËĸöÌØÐÔ£¬·Ö±ðÊÇ£ºÔ×ÓÐÔ£¬Ò»ÖÂÐÔ£¬¸ôÀëÐԺͳ־ÃÐÔ¡£
Ë÷Òý¾ÍÒ»ÖÖÌØÊâµÄ²éѯ±í£¬Êý¾Ý¿âµÄËÑË÷ÒýÇæ¿ ......
ËäÈ»±¾ÈËûÓÐÑéÖ¤¹ý,²»¹ý¾Ý˵ͨ¹ýADODB·ÃÎÊOracle¶ÔÐÔÄÜÓ°ÏìºÜС.¶øÇÒADODB±ÈOCI8Ò²Òª·½±ãºÜ¶à,±Ï¾¹Ðí¶à¶«Î÷¶¼Ôٴηâ×°¹ý.²»¹ý²»¹ÜÔõô˵Õâ¶¼ÔÚÖмäÓÖ¼ÓÉÏÁËÒ»²ã,ÀíÂÛÉÏÀ´Ëµ³öÏÖÎÊÌâµÄ¼¸Âʺͽâ¾öÎÊÌâµÄÄѶȶ¼±ä´óÁË.¶øOracleÓÖ¾³£ÓÃÔÚ²»ÄÜËæ±ã³öÎÊÌâµÄ»·¾³,ËùÒÔÏë±ØÏëÒªÖ±½ÓʹÓÃOCIµÄÇé¿öÒ²²»ÉÙ.ÒÔϾÍÊÇÎÒµÄÀý×Ó:
<?p ......