Beruflich Dokumente
Kultur Dokumente
Inthislab,youwillimplementaVPDcase.Itisagoodideatorefertothe
supplementalmaterials.Pleasefollowthespecificationsbelow.
Yourtasksareasfollows:
1. ConnecttouserSYSTEM.(5points)WhenyouneedtoconnecttoSYSTEM
schema,pleaseuseasyntaxsothatitwillasktheusertotypethepassword.A
typicalexamplewillbe:"connectsystem"
2. Grant"DBA"roletouserDBSEC.Thisisthesameusercreatedonaprevious
lab.Ifforsomereason,theuserwasdropped,youneedtorecreatetheuser
beforeproceeding.(5points)
3. Grant"CREATESESSION"and"CREATETABLE"privilegestouser
VPD_CLERK1.(5points)
4. ConnecttouserDBSEC/IS481%sec.Pleasenotethatthepasswordwasfrom
ourpreviouslab.Ifforsomereason,theuserwasdroppedorchanged,you
needtochangeitbacktotheaboveusernameandpassword.(5points)
5. Create"CUSTOMER"tablewiththefollowingcolumns.Pleasenoteslight
changesinthetablefrompreviousproject.(10points)
ColumnName
DataType
SALES_REP_ID
NUMBER(4)
CUSTOMER_ID
NUMBER(8)NOTNULL
CUSTOMER_SSN
VARCHAR2(9)
FIRST_NAME
VARCHAR2(20)
LAST_NAME
VARCHAR2(20)
ADDR_LINE
VARCHAR2(80)
CITY
VARCHAR2(30)
STATE
VARCHAR2(30)
ZIP_CODE
VARCHAR2(9)
PHONE
VARCHAR2(15)
VARCHAR2(80)
CC_NUMBER
VARCHAR2(20)
CREDIT_LIMIT
NUMBER
GENDER
CHAR(1)
STATUS
CHAR(1)
COMMENTS
VARCHAR2(1024)
CTL_UPD_DTTM
DATE
CTL_UPD_USER
VARCHAR2(30)
CTL_REC_STAT
CHAR(1)
6. PopulatetheCUSTOMERtableusingthedatainthefileprovided.Clickhereto
downloadthedatafile.(Ifyourwebbrowserissetatautomode,youmayhave
torightclickthewordhereandselect"SaveLinkTargetAs"inordertodownload
thescriptfile.)
Youmayeitherputall"insert"statementswithinthisfile,orprovidealinkto
anotherfile.Ifyouusethelink,pleasemakesureyourlinkworksonyour
computer.(10points)
7. Querythetable"CUSTOMER"toshowthetotalnumberofrowsfromeach
user.(5points)
8. GrantSELECT,DELETE,INSERTandUPDATEprivilegesonCUSTOMERtable
touserVPD_CLERK1.(5points)
9. Createapolicyfunction,named"DBSEC_ROW_OWNER_FUNCTION"sothat
onlythedatathatbelongtothecurrentuserwillbeselected.Inotherwords,you
needtogenerateapredicate"CTL_UPD_USER=USER."Youmayrefertothe
supplementmaterialonthisweekforasamplecode.Pleasenotetheownerof
thetable(DBSEC)hastobeabletoaccessitsowntable.(20points)(Please
notethedoublequotationmark(")isnotapartofthespecification.)
10. AddthepolicyusingDBMS_RLS.ADD_POLICYfunction.Thepolicywillbe
namedas"MY_OWNER_POLICY."(20points)
11. ConnecttoVPD_CLERK1/Nancy#481.(5points)
12. Querythe"CUSTOMER"tabletoshowthetotalnumberofrowsfromeachuser.
Ifeverythingissuccessful,youwillseeonlyonerow.(5points)
Tip:
ItisimportanttomakesurethatyouareconnectedtouserDBSEC/IS481%sec,
beforecreatingthepolicyfunctionandrunningDBMS_RLS.ADD_POLICY.
Otherwise,youwillseeORA28110.
SubmissionRequirement:
TheSQLscriptfileswillberequiredandthescreencaptureofthelabcompleted
steps.