100% found this document useful (1 vote)
105 views3 pages

Lab#7 Granting Privileges, Creating Synonyms, Sequences, and Views

1. The document provides instructions for a database administration lab involving granting privileges to users, creating synonyms, sequences, and a view. Students are asked to complete 8 tasks, documenting their SQL commands and outputs. 2. The tasks include granting SELECT privileges to tables for 3 users, granting an INSERT privilege, confirming privileges with DBA_TAB_PRIVS, creating public synonyms for tables, inserting sample data, selecting data using synonyms, creating and using a sequence, altering a table to use the sequence, creating a view combining columns and computations, granting privileges on the view. 3. Students are instructed to format outputs clearly and show all commands, with points awarded based on successful completion of the tasks.

Uploaded by

Gautam Trivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
105 views3 pages

Lab#7 Granting Privileges, Creating Synonyms, Sequences, and Views

1. The document provides instructions for a database administration lab involving granting privileges to users, creating synonyms, sequences, and a view. Students are asked to complete 8 tasks, documenting their SQL commands and outputs. 2. The tasks include granting SELECT privileges to tables for 3 users, granting an INSERT privilege, confirming privileges with DBA_TAB_PRIVS, creating public synonyms for tables, inserting sample data, selecting data using synonyms, creating and using a sequence, altering a table to use the sequence, creating a view combining columns and computations, granting privileges on the view. 3. Students are instructed to format outputs clearly and show all commands, with points awarded based on successful completion of the tasks.

Uploaded by

Gautam Trivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

File=cmis565_lab7.

htm; July 10, 2013


 
Oracle Database Administration – Lab #7
Granting Privileges, Creating Synonyms, Sequences, and Views (10 points)
 
Situation:  In this laboratory you will perform a variety of tasks required to maintain data and
make your database easier for the system developer to use.  You may elect to complete the
laboratory individually, or you may team up with 1 to 2 laboratory partners.  If you team up with
partners, you will select your own partners and you will be graded as a group and you will
submit a single document as evidence of your team's work. 
 
Use Notepad, Wordpad, or Microsoft Word to document your solution to the tasks in the
laboratory. 
 Label your answer to each clearly by typing the number/letter (example 2a) in bold print.
 Show each command you execute and the computer's response (example
response:  Database Altered, Tablespace Created, etc.).  If you don't show the commands you
execute, then your answer will be counted as wrong.
 Print your output using 10 point Courier or Courier New font (so the output lines up and is
easy to read).
         Format your output as necessary to make it easy to read.  Do not submit for
grading anything you would not submit to your boss for review in an actual work
environment, i.e. in other words, do not turn in sloppy work that is difficult for me to
grade.   
 

Tasks for this Lab


1.  Granting privileges (1 points). 
a.    Connect as the DBA (NOT SYS) of your database.  Execute the SHOW USER command.
b.    In an earlier lab you created three users - Al, Bill and Susan.  Grant each of these users
the privilege to select on the following tables:  VENDOR, INVOICE, INVOICE_DETAILS,
and PRODUCT (these are tables that you created in laboratory #5).  Use the MINIMUM
number of SQL statements that you can in granting the privilege. 
c.    Grant Al the privilege to insert new rows in each of the tables specified in 1b.  Use the
MINIMUM number of SQL statements that you can in granting the privilege. 
d.    While connected as the DBA select the rows from the DBA_TAB_PRIVS view to confirm
that each user has the privilege needed to select rows from the tables. 
 
2.  Create synonyms (1 point). 
a.    Ensure that you are connected as the DBA.  Execute the SHOW USER command.
b.    Create public synonyms named VENDOR, INVOICE, INVOICE_DETAILS,
and PRODUCT for the tables that you created in your earlier laboratory. 
 
3.  Storing additional test data (1 point). 
a.    Connect as the user Al.  Execute the SHOW USER command.
b.    Create data for one sample invoice.  The invoice must be for two of the products stored in
your PRODUCT table.  Insert the new data rows into
the INVOICE and INVOICE_DETAILStables (your insert should use the public synonym
created in #2 above). 
 
4.  Selecting from tables (1 point).
a.    Connect as the user named Susan.  Execute the SHOW USER command.
b.    Execute two SELECT statements to display the data stored in
the INVOICE and INVOICE_DETAILS tables by using the public synonyms. 
 
5.  Creating Sequences (2 points). 
a.    Connect as the DBA.  Execute the SHOW USER command.
b.    Create a sequence named VENDOR_SEQUENCE that starts with the value 1 and is
incremented by 1.  Set the values for MINVALUE = 1 and MAXVALUE = 99999.   Allow
the sequence to CYCLE automatically and allocate NOCACHE as a sequence option. 
c.    Create a public synonym for the VENDOR_SEQUENCE
d.    Attempt to SELECT a value from the VENDOR_SEQUENCE by using the DUAL table in
your SELECT command. 
 
6.  Using Sequences (2 points). 
a.    You are still connected as the DBA.  Alter the VENDOR table to add a new column
named SequenceColumn.  This new column should be defined as a NUMBER(5)
datatype. 
b.    Grant the object privileges SELECT, INSERT, and UPDATE to Al on the VENDOR table
object. 
c.    Grant the object privilege SELECT to Al on the VENDOR_SEQUENCE object.
d.    Connect as the user Al.   Execute the SHOW USER command.  Edit all existing rows in
the VENDOR table such that you replace each row’s SequenceColumn value with
a uniquevalue generated from the VENDOR_SEQUENCE. 
e.    Display the output of the query:  SELECT * FROM Vendor;
 
7.    Creating a View (2 points). 
a.    Connect as the DBA.  Execute the SHOW USER command.
b.    Create a SALES_INVOICE view that combines the following columns from the files
indicated.  The view should also provide the computed "fields" indicated. 
1)    VENDOR: Vendor_Number, Vendor_Name.
2)    INVOICE: Invoice_Number, Invoice_Date, Invoice_Amount.
3)    INVOICE_DETAILS: Quantity_Ordered, Actual_Price.
4)    PRODUCT: Product_Number, Description.
5)    COMPUTED FIELDS: LineTotal (this is the Quantity_Ordered multiplied by
Actual_Price).
c.    Create a public synonym for the SALES_INVOICE view.
d.    Grant permission to select from the view to all database users (use the minimum number
of commands possible to grant this permission), then connect as the user named Susan
and attempt to display the data for a single Customer Sales Invoice from your database. 
 
8.    Shut down the database (-1 point if you forget to shutdown). 
 
Do not leave your database running between laboratory sessions.
 

END OF ASSIGNMENT. 
  
 

You might also like