Oracle ÊÓͼ
ÊÓͼ(view)£¬Ò²³ÆÐé±í, ²»Õ¼ÓÃÎïÀí¿Õ¼ä£¬Õâ¸öÒ²ÊÇÏà¶Ô¸ÅÄÒòΪÊÓͼ±¾ÉíµÄ¶¨ÒåÓï¾ä»¹ÊÇÒª´æ´¢ÔÚÊý¾Ý×ÖµäÀïµÄ¡£ÊÓͼֻÓÐÂß¼¶¨Ò塣ÿ´ÎʹÓõÄʱºò, Ö»ÊÇÖØÐÂÖ´ÐÐSQL.
»¹ÓÐÒ»ÖÖÊÓͼ£ºÎﻯÊÓͼ£¨MATERIALIZED VIEW £©£¬Ò²³ÆÊµÌ廯ÊÓͼ£¬¿ìÕÕ £¨8i ÒÔǰµÄ˵·¨£© £¬ËüÊǺ¬ÓÐÊý¾ÝµÄ£¬Õ¼Óô洢¿Õ¼ä¡£ ¹ØÓÚÎﻯÊÓͼ£¬¾ßÌå²Î¿¼ÎÒµÄblog£º
Oracle ÎﻯÊÓͼ
http://blog.csdn.net/tianlesoftware/archive/2009/10/23/4713553.aspx
Ò». ÊÓͼµÄÌØµã
1. ¼¯ÖÐÓû§¸ÐÐËȤµÄÊý¾Ý. ͨ³£Óû§Ö»ÊǶԱíÖеÄijһ²¿·ÖÊý¾Ý¸ÐÐËȤ, ¶ÔÆäËûµÄÊý¾Ý²»ÊÇÄÇôÃô¸Ð, ËùÒÔÓû§Í¨¹ýÊÓͼ¾Í¿ÉÒÔ²Ù ×Ý×Ô¼ºËùÐèµÄÊý¾Ý. ¶ÔÓÚ¿ª·¢ÈËÔ±À´Ëµ, Ò²¿ÉÒÔÆÁ±ÎһЩÊý¾Ý.
2. ÑÚÂëÊý¾Ý¿âµÄ¸´ÔÓÐÔ. ͨ¹ýÊÓͼ»úÖÆ½«Êý¾Ý¿âÉè¼ÆµÄ¸´ÔÓÐÔÓëÓû§ÆÁ±Î·Ö¿ª, ÕâÑùÓû§Í¨¹ýÊÓͼµÄ²Ù×÷¾Í¿ÉÒÔ´ïµ½¼ò»¯¶ÔÊý¾Ý¿âµÄ¸´ÔÓ²Ù×÷.
3. ¼ò»¯Óû§µÄȨÏÞ. ÓÉÓÚÊÓͼֻÊÇ»ù±íµÄÂß¼±í, ËùÒÔͨ¹ýÊÓͼ¿ÉÒÔ½«ÊÓͼµÄȨÏ޺ͻù±íȨÏÞ·ÖÀë.
4. ÖØ×éÊý¾Ý. ÊÓͼ¿ÉÒÔÀ´×Ô¶à¸ö»ù±í, ´Ó¶ø¿ÉÒÔÀûÓÃÊÓͼ¶ÔÊý¾Ý½øÐнøÒ»²½µØ·ÖÎö.
¶þ. ÊÓͼ¿ÉÒÔÓÉÒÔÏÂÈÎÒâÒ»Ïî×é³É:
1. Ò»¸ö»ù±íµÄÈÎÒâ×Ó¼¯
2. Á½¸ö»òÁ½¸öÒÔÉϵĻù±íµÄºÏ¼¯
3. Á½¸ö»òÁ½¸öÒÔÉÏ»ù±íµÄ½»¼¯
4. Ò»¸ö»òÕß¶à¸ö»ù±íÔËËãµÄ½á¹û¼¯ºÏ
5. ÁíÒ»¸öÊÓͼµÄ×Ó¼¯.
Èý. ´´½¨ÊÓͼµÄ»ù±¾Óï·¨:
CREATE[OR REPLACE][FORCE][NOFORCE]VIEW view_name
[(column_name)[,….n]]
AS
Select_statement
[WITH CHECK OPTION[CONSTRAINT constraint_name]]
[WITH READ ONLY]
˵Ã÷:
view_name : ÊÓͼµÄÃû×Ö
column_name: ÊÓͼÖеÄÁÐÃû
ÔÚÏÂÁÐÇé¿öÏ , ±ØÐëÖ¸¶¨ÊÓͼÁеÄÃû³Æ
* ÓÉËãÊõ±í´ïʽ , ϵͳÄÚÖú¯Êý»òÕß³£Á¿µÃµ½µÄÁÐ
* ¹²Ïíͬһ¸ö±íÃûÁ¬½ÓµÃµ½µÄÁÐ
* Ï£ÍûÊÓͼÖеÄÁÐÃûÓë±íÖеÄÁÐÃû²»Í¬µÄʱºò
REPLACE: Èç¹û´´½¨ÊÓͼʱ, ÒѾ´æÔÚ´ËÊÓͼ, ÔòÖØÐ´´½¨´ËÊÓͼ, Ï൱ÓÚ¸²¸Ç
FORCE: Ç¿ÖÆ´´½¨ÊÓͼ, ÎÞÂÛµÄÊÓͼËùÒÀÀµµÄ»ù±í·ñ´æÔÚ»òÊÇ·ñÓÐȨÏÞ´´½¨
NOFORCE:
Ïà¹ØÎĵµ£º
1¡¢´´½¨±í£º
create table stud(
sid int,
sname varchar2(50)
)
²¢²åÈëÒ»ÌõÊý¾Ý
&n ......
ÔÚÎÒ¿ª·¢BS½á¹¹³ÌÐòÖУ¬ÓÉÓÚ¾³£ÐèÒªÔÚORACLEÖд¦ÀíһЩÈÝÁ¿½Ï´óµÄÎı¾Êý¾Ý£¬ËùÒÔ¾¹ý·´¸´²âÊÔÖÕÓÚÓÃASP³É¹¦½â
¾öÁË´óÎı¾Êý¾ÝÔÚORACLEÏ´æÈ¡ÎÊÌâ¡£
¡¡¡¡
¡¡¡¡Ò»¡¢ÔËÐл·¾³£º
¡¡¡¡1¡¢Microsoft Windows 2000 Server + IIS 5.0
2¡¢Oracle8iÖÐÎıê×¼°æ
¡¡¡¡
¡¡¡¡¶þ¡¢½¨Á¢Êý¾Ý±í£º
¡¡¡¡CREATE TABLE SYSTEM.TEST(
B ......
OracleÓëMySQLÖГ¿É´®Ðл¯”µÄ¶Ô±È²âÊÔ
Thomas Kyte ÔÚ“Oracle 9i&10g±à³ÌÒÕÊõ”Ò»ÊéÖÐΪÁË˵Ã÷ÊÂÎñµÄ¸ôÀë¼¶±ð£¬ÌṩÁËһЩÀý×Ó¡£ÕâÀïÎÒÃÇÀ´¿´¿´“¿É´®Ðл¯”¼¶±ðϵıíÏÖ¡£
ÒÔÆÕͨÓû§µÇ¼ϵͳ£¬²¢´´½¨²âÊÔÓÃµÄ±í¡£
idle> connect scott/tiger
......
1¡¢ÔÚ±¾»ú69ÉÏ´´½¨Êý¾Ý¿âorcl £¬global_name=orcl£¬Ê¹ÓÃÓï¾ä
alter database rename global_name to orcl.us.oracle.com ÐÞ¸ÄÊý¾Ý¿âµÄÈ«¾ÖÊý¾Ý¿âÃûΪorcl.us.oracle.com
2¡¢ÔÚÐé»ú188ÉÏ´´½¨Êý¾Ý¿âviotest£¬global_name=viotest£¬Ê¹ÓÃÓï¾ä
alter database rename global_name to viotest.us.oracle.com ÐÞ¸ÄÊý¾Ý¿âµÄÈ«¾ÖÊ ......