ORACLE Schema µÄÀí½â
¿´À´ÓеÄÈË»¹ÊǶÔschemaµÄÕæÕýº¬Ò岻̫Àí½â£¬ÏÖÔÚÎÒÔÙ´ÎÕûÀíÁËһϣ¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂËûÃǵĶ¨Ò壺
A schema is a collection of database objects (used by a user.).
Schema objects are the logical structures that directly refer to the database’s data.
A user is a name defined in the database that can connect to and access objects.
Schemas and users help database administrators manage database security.
´Ó¶¨ÒåÖÐÎÒÃÇ¿ÉÒÔ¿´³öschemaΪÊý¾Ý¿â¶ÔÏóµÄ¼¯ºÏ£¬ÎªÁËÇø·Ö¸÷¸ö¼¯ºÏ£¬ÎÒÃÇÐèÒª¸øÕâ¸ö¼¯ºÏÆð¸öÃû×Ö£¬ÕâЩÃû×Ö¾ÍÊÇÎÒÃÇÔÚÆóÒµ¹ÜÀíÆ÷µÄ·½°¸Ï¿´µ½µÄÐí¶àÀàËÆÓû§ÃûµÄ½Úµã£¬ÕâЩÀàËÆÓû§ÃûµÄ½ÚµãÆäʵ¾ÍÊÇÒ»¸öschema£¬schemaÀïÃæ°üº¬Á˸÷ÖÖ¶ÔÏóÈçtables, views, sequences, stored procedures, synonyms, indexes, clusters, and database links¡£
Ò»¸öÓû§Ò»°ã¶ÔÓ¦Ò»¸öschema,¸ÃÓû§µÄschemaÃûµÈÓÚÓû§Ãû£¬²¢×÷Ϊ¸ÃÓû§È±Ê¡schema¡£ÕâÒ²¾ÍÊÇÎÒÃÇÔÚÆóÒµ¹ÜÀíÆ÷µÄ·½°¸Ï¿´µ½schemaÃû¶¼ÎªÊý¾Ý¿âÓû§ÃûµÄÔÒò¡£OracleÊý¾Ý¿âÖв»ÄÜд´½¨Ò»¸öschema£¬ÒªÏë´´½¨Ò»¸öschema£¬Ö»ÄÜͨ¹ý´´½¨Ò»¸öÓû§µÄ·½·¨½â¾ö(OracleÖÐËäÈ»ÓÐcreate schemaÓï¾ä£¬µ«ÊÇËü²¢²»ÊÇÓÃÀ´´´½¨Ò»¸öschemaµÄ)£¬ÔÚ´´½¨Ò»¸öÓû§µÄͬʱΪÕâ¸öÓû§´´½¨Ò»¸öÓëÓû§ÃûͬÃûµÄschem²¢×÷Ϊ¸ÃÓû§µÄȱʡshcema¡£¼´schemaµÄ¸öÊýͬuserµÄ¸öÊýÏàͬ£¬¶øÇÒschemaÃû×ÖͬuserÃû×ÖÒ»Ò» ¶ÔÓ¦²¢ÇÒÏàͬ£¬ËùÓÐÎÒÃÇ¿ÉÒÔ³ÆschemaΪuserµÄ±ðÃû£¬ËäÈ»ÕâÑù˵²¢²»×¼È·£¬µ«ÊǸüÈÝÒ×Àí½âһЩ¡£
Ò»¸öÓû§ÓÐÒ»¸öȱʡµÄschema£¬ÆäschemaÃû¾ÍµÈÓÚÓû§Ãû£¬µ±È»Ò»¸öÓû§»¹¿ÉÒÔʹÓÃÆäËûµÄschema¡£Èç¹ûÎÒÃÇ·ÃÎÊÒ»¸ö±íʱ£¬Ã»ÓÐÖ¸Ã÷¸Ã±íÊôÓÚÄÄÒ»¸öschemaÖеģ¬ÏµÍ³¾Í»á×Ô¶¯¸øÎÒÃÇÔÚ±íÉϼÓÉÏȱʡµÄshemanÃû¡£±ÈÈçÎÒÃÇÔÚ·ÃÎÊÊý¾Ý¿âʱ£¬·ÃÎÊscottÓû§ÏµÄemp±í£¬Í¨¹ýselect * from emp; Æäʵ£¬ÕâsqlÓï¾äµÄÍêÕûд·¨Îªselect * from scott.emp¡£ÔÚÊý¾Ý¿âÖÐÒ»¸ö¶ÔÏóµÄÍêÕûÃû³ÆΪschema.object£¬¶ø²»Êôuser.object¡£ÀàËÆÈç¹ûÎÒÃÇÔÚ´´½¨¶ÔÏóʱ²»Ö¸¶¨¸Ã¶ÔÏóµÄschema£¬ÔڸöÔÏóµÄschemaΪÓû§µÄȱʡschema¡£Õâ¾ÍÏñÒ»¸öÓû§ÓÐÒ»¸öȱʡµÄ±í¿Õ¼ä£¬µ«ÊǸÃÓû§»¹¿ÉÒÔʹÓÃÆäËûµÄ±í¿Õ¼ä£¬Èç¹ûÎÒÃÇÔÚ´´½¨¶ÔÏóʱ²»Ö¸¶¨±í¿Õ¼ä£¬Ôò¶ÔÏó´æ´¢ÔÚȱʡ±í¿Õ¼äÖУ¬ÒªÏëÈöÔÏó´æ´¢ÔÚÆäËû±í¿Õ¼äÖУ¬ÎÒÃÇÐèÒªÔÚ´´½¨¶ÔÏóʱָ¶¨¸Ã¶ÔÏóµÄ±í¿Õ¼ä¡£
¿È£¬ËµÁËÕâô¶à£¬¸ø´ó¼Ò¾Ù¸öÀý×Ó£¬·ñÔò£¬Ò»ÇпÝÔïÎÞζ£¡
SQL>
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
ƽʱºÜÉÙÓõÄÕ⼸¸ö²Ù×÷£¬½ñÌìÓöµ½ÁË¡£ÓÚÊÇÓÖ¿´ÁËÒ»ÏÂÎĵµ¡£
SOMEºÍANYÒ»Ñù£¬ÊDZȽϿíËɵģ¬ÀàËÆÓÚOR¡£Âú×ãÆäÖÐÈκÎÒ»¸ö¶¼¿ÉÒÔ¡£
ALLÒªÇóÑϸñһЩ£¬ÀàËÆÓÚAND£¬±ØÐëÈ«²¿Âú×ã²Å¿ÉÒÔ¡£
²»Äܵ¥¶ÀʹÓ㺠Must be preceded by =, !=, >, <, <=, >=.
Æäʵ¸üÓ¦¸Ã¹Ø×¢µÄÊǽô¸ú×ŵı¸×¢ÐÅÏ¢£¬Õâ¸öÒ»¿ªÊ¼±È½ÏÄÑÒÔÀí½â ......
Ò».ÌÞ³ý±íÖÐÊý¾ÝÁ½ÖÖ²½Öè
a. delete * from My_Table;
b. truncate table My_Table;
¶þ.ÌÞ³ýÕû¸ö±í
drop table My_Table;
ºÎÒԻظ´²»Ð¡ÐÄ Drop µôµÄ±íÄØ,ʵÔò Oracle ÖÐÒ²ÓÐÏà·ÂµÄ "»ØÊÕÕ¾"
ÀýÈ粻СÐÄÌÞ³ýÁ˱í My_Table
drop table My_Table;
Õâ¸öʱ·ÖÔÙÓÃSELECT»°Óï²éѯ´Ë±íʱ£¬½«»áÌáÐѱí»òÊÓͼ²»´æÔÚ.
µ«¿ÉÒÔÓ ......
ÈçºÎÔÚoracleÖе¼ÈëdmpÊý¾Ý¿âÎļþ
OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
Ö´Ðл·¾ ......
ORACLEµÄÒ»¸öÊý¾ÝÎļþµÄ×î´óÖµÊǶàÉÙÄØ£¿
ÎÒÃÇÖªµÀORACLEµÄ×îСµÄÎïÀíµ¥Î»ÊÇBLOCK£¬Êý¾ÝÎļþµÄ×é³ÉµÄ×îÖÕÐÎʽҲÊÇblock£¬ÄÇôÊý¾ÝÎļþµÄ´óСÏÞÖƾÍÓ¦¸ÃÊÇblockÊýÁ¿µÄÏÞÖÆ£¬ÄÇô¾¿¾¹blockµÄÊýÁ¿ÓкÎÏÞÖÆ£¬ÕâÀï¾ÍÒªÌáµ½Ò»¸öORACLEÄÚ²¿ÊõÓïDBA(´Ëdba·ÇÊý¾Ý¿â¹ÜÀíÔ±£¬¶øÊÇdata block address)
Extent 0 &n ......