Dba Report
Dba Report
A Lab Report On
Database Administration (CSC 414)
1. Locate the tablespace, data files, control files, online redo log files and parameter file
(spfile) in your database using different dynamic performance views.
-Contorl File
-Parameter file(spfile)
2. Practice different startup and shutdown modes.
3. User Management
a. User creation
i. Create three new database users named user1, user2, and user3
ii. Each new user is identified by the password 12345.
iii. Their default tablespace is USERS.
iv. Their temporary tablespace is TEMP.
v. The quota is 20K on USERS.
vi. The profile is the Oracle database default profile.
vii. Delete the user with and without having object
2. Deleting users: Delete user without removing their objects and with their objects
b.Granting Privileges
i.Mention different system and object privileges
Object Privileges: These are granted on specific objects like tables, views, or procedures. Examples
include SELECT, INSERT, UPDATE, DELETE, EXECUTE, etc.
System Privileges: These are granted to enable users to perform administrative and system-wide
tasks, such as creating tables, logging in, and altering users. Examples include CREATE SESSION,
CREATE TABLE, ALTER USER, DROP USER, etc.
ii. Alter the user named User1 to assign an unlimited quota on the USERS tablespace.
iii. Attempt to commect to the database as user User1. Why can't you connect? Grant User1 the
privilege needed to connect to the system.
>The reason why User1 cannot connect is that they likely do not have the CREATE SESSION
privilege. By default, Oracle does not grant this privilege to users when they are created.
GRANTING PRIVELEGES
iv.Creating a table by a user – insert row data and query the table to list the rows you inserted
to verify their existence.
v.Granting SELECT privilege and test the effect. Also do practice of passing object
privileges with grant option.
vi.Granting INSERT privileges and inserts some rows from another user.
vii.Grant update privilege on table for specified column only
vii.Grant system privileges to the user and pass the system privileges to other user with admin option
and observe the impact.
sql>>grant create user to user1 with admin option;
c.Role
i.Create a Role and grant privileges to roles and grant roles to the users.
ii.Grant role to other role and assign role to user and test the impact
iii.Revoke system/object privileges granted to roles and users
d.Data dictionary views to list the privileges
List the system privileges, object privileges and roles granted/received by the user
e.Profile
i. Create Profile with following parameter and assign the profile to the user
SESSIONS_PER_USER 2
FAILED_LOGIN_ATTEMPTS 3
IDLE_TIME 2 (in minutes)
CONNECT_TIME 5 (in minutes)
PASSWORD_LIFE_TIME 60
PASSWORD_GRACE_TIME 10
PASSWORD_REUSE_TIME 1
PASSWORD_LOCK_TIME 7
PASSWORD_REUSE_MAX 3;
ii. Apply the profile by setting the resource_limit parameter true
iii Alter the profile and check the impact of it
iv Delete the profile and check the user profile assigned after profile deleted
Lab Assignment 2
1) Creating oracle objects:
a) Table:
i. Create table with different datatype with primary key
ii. Add foreign key and check constraint
b. Add an additional Redo Log File to each of the two existing Redo Log Groups for
your database
c. Add an additional Redo Log Group with two Redo Log Files in the group
d. Query both V$LOG and V$LOGFILE to verify the result
2) Edit the CONTROL_FILES parameter in the database initialization parameter file to add
the new control file name, or to change the existing control file name.
3) Shutdown database
4) Startup database.
3. Create static parameter file (pfile) from dynamic parameter file (spfile)
LAB ASSIGNMENT 4
A tablespace is a logical storage unit in Oracle Database that groups related logical
structures together. It is a container that stores database objects such as tables,
indexes, and other schema objects. Each tablespace is made up of one or more
datafiles, which are physical files that reside on the filesystem or disk storage.
a. create tablespace
b. rename tablespace
f. drop datafile
g. drop tablespace.
•If you want to restore the SPFILE from the autobackup, you must first set the DBID
for your database, and then use the RESTORE SPFILE FROM AUTOBACKUP
command.
RMAN> SET DBID 320066378;
RMAN> RESTORE SPFILE FROM AUTOBACKUP RECOVERY
AREA='E:\Flash_Recovery_Area' db_name=xe;
5.Write a command to take a logical backup and recovery using datapump utility at following
level:
a.Full backup and recovery
1.Write a procedure to fetch all the table names inside schema using cursor.
SET SERVEROUTPUT ON
OPEN c_tables;
LOOP
FETCH c_tables INTO v_table_name;
EXIT WHEN c_tables%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('Table Name: ' || v_table_name);
END LOOP;
CLOSE c_tables;
END get_all_tables_in_schema;
/
BEGIN
get_all_tables_in_schema;
END;
/
2.Write a PLSQL block to demonstrate the conditional statements (if, if ese if).
declare
age number;
begin
age := &age_input;
if age > 20 then
dbms_output.put_line('you can drive a car');
elsif age >= 18 then
dbms_output.put_line('you can drive a car with a parental guid');
else
dbms_output.put_line('you cannot drive a car');
end if;
end;
/
3.Write a PLSQL block to demonstrate the iterative statements (simple loop, while loop, and
for loop).
--while loop
declare
cursor std_cursor is select * from student where gpa >= 3;
std std_cursor%rowtype;
begin
open std_cursor;
fetch std_cursor into std;
end;
/
--simple loop
declare
cursor std_cursor is select * from student where gpa < 3.8;
std std_cursor%rowtype;
begin
open std_cursor;
fetch std_cursor into std;
loop
dbms_output.put_line('Name:'||std.name||' GPA'||std.gpa);
fetch std_cursor into std;
exit when std_cursor%notfound;
end loop;
end;
/.
-- for loop
declare
cursor std_cursor is select * from student where gpa > 3;
begin
for std in std_cursor loop
dbms_output.put_line('Name:'||std.name||' GPA'||std.gpa);
end loop;
end;
/
begin
dbms_output.put_line('No of A students in table='||a_student());
end;
/
END mypackage;
/