MSCD640/MCT615 Lab 2 Name: _________________________________________ Date: __________________________________________ ----------------------------------------------------------------------------------The purpose of this lab is to become familiar with the following types of basic DBA tasks: Managing users and basic security Creating and managing tables and constraints Creating and managing indexes Creating and managing views, synonyms, and sequences Read Chapters 6 through 9 in the book before starting this lab. These labs focus on how to perform DBA tasks from the SQL*Plus command prompt. These labs do not show how to perform tasks from Enterprise Manager. I prefer that students learn basic DBA tasks from SQL*Plus for the following reasons: Not all environments have Enterprise Manager installed, therefore you’ll need to know how to perform basic DBA tasks from the SQL command prompt. Performing the tasks manually from SQL gives you a better understanding of the underlying SQL used to accomplish DBA tasks. If you can perform DBA tasks from SQL, then you’ll have no problems understanding how to perform the same tasks in Enterprise Manager. To get an “A” grade on this lab: Answer all questions. Provide output of steps that require you to perform a task. The output can be a spool file, cut and paste from the screen to a word document, screen shots. I need to see something to verify that you ran the labs. I’m expecting you to turn in a word document that contains each question and also the corresponding answers to questions asked and output from SQL statements. ----------------------------------------------------------------------------------Lab 2, Part 1: Users and Basic Security Read Chapter 6 in the book. ----------------------------------------------------------------------------------1. Startup your database, from the operating system prompt: sqlplus / as sysdba SQL> show user; SQL> startup; SQL> select name from v$database; ----------------------------------------------------------------------------------2. What users exist in your database? 11g book: page 112 12c book: page 127 SQL> select username,lock_date,expiry_date, created from dba_users order by 1; What’s the difference between the LOCK_DATE and EXPIRY_DATE? ----------------------------------------------------------------------------------3. Lock all of the users in your database except for SYS. To perform this task, use SQL that generates SQL. 11g book: page 112 12c book: page 128 select 'alter user ' || username || ' password expire account lock;' from dba_users where username not in ('SYS'); Run the SQL statements that are generated by the prior SQL to actually lock the accounts. Verify that the accounts are locked: SQL> select username, lock_date, expiry_date, created from dba_users order by 1; ----------------------------------------------------------------------------------4. Unlock the SYSTEM account. 11g book: page 112 12c book: page 140 SQL> alter user system account unlock; ----------------------------------------------------------------------------------5. Are there any accounts in your database that aren’t the default accounts? Run this script while connected to the SYS user. 11g book: page 113 12c book: page 130 select distinct u.username ,case when d.user_name is null then 'DBA created account' else 'Oracle created account' end from dba_users u ,default_pwd$ d where u.username=d.user_name(+) order by 1; ----------------------------------------------------------------------------------6. Which accounts in your database have never had the password changed? Run this script while connected to the SYS user. 11g book: page 113 12c book: page 144 select name ,to_char(ctime,'dd-mon-yy hh24:mi:ss') ,to_char(ptime,'dd-mon-yy hh24:mi:ss') ,length(password) from user$ where password is not null and password not in ('GLOBAL','EXTERNAL') and ctime=ptime; ----------------------------------------------------------------------------------7. What are the differences between the SYS and SYSTEM users in an Oracle database? 11g book: page 114 12c book: page 128 ----------------------------------------------------------------------------------8. Alter the password for the SYSTEM user to a password of your choice: SQL> alter user system identified by <input a password here>’; For example: SQL> alter user system identified by foo; ----------------------------------------------------------------------------------9. Connect to the SYSTEM account with the password that you established in the prior step: SQL> connect system/<input password> For example: SQL> connect system/foo SQL> show user; ----------------------------------------------------------------------------------10. Check on the default and permanent tablespaces for users in your database: set linesize 132 -select username ,default_tablespace ,temporary_tablespace from dba_users; For any users in your database, would you recommend changing what the current default and temporary tablespace are? ----------------------------------------------------------------------------------11. Create a user in your database. Run this script while connected to the SYSTEM account. 11g book: page 115 12c book: page 133 create user heera identified by chaya default tablespace users temporary tablespace temp; ----------------------------------------------------------------------------------12. Attempt to connect to the user you just created: SQL> connect heera/chaya What happens? ----------------------------------------------------------------------------------13. Connect as SYSTEM and grant the appropriate privileges required to allow a user to connect to the database: SQL> conn system/<password> SQL> grant create session to heera; Now try to connect as HEERA: SQL> connect heera/chaya What happens? Which user are you connect as to your database? SQL> show user; ----------------------------------------------------------------------------------14. Connect to SYSTEM and alter the password of the HEERA account: SQL> conn system/<password> SQL> alter user heera identified by foobar; ----------------------------------------------------------------------------------15. As SYS, create a secure password function. 11g book: pages 119-120 12c book: page 144 SQL> conn / as sysdba SQL> show user; SQL> @?/rdbms/admin/utlpwdmg ----------------------------------------------------------------------------------16. Does the default profile for your database have a password verify function assigned to it? SQL> set lines 132 SQL> select * from dba_profiles where profile = 'DEFAULT'; ----------------------------------------------------------------------------------17. Alter the default profile for your database to use the password function: 11g database (page 119): SQL> alter profile default limit PASSWORD_VERIFY_FUNCTION verify_function_11G; Verify: SQL> select * from dba_profiles where profile = 'DEFAULT'; 12c database (page 145): SQL> alter profile default limit PASSWORD_VERIFY_FUNCTION ora12c_verify_function; Verify: SQL> select * from dba_profiles where profile = 'DEFAULT'; ----------------------------------------------------------------------------------18. Attempt to alter the HEERA user’s password: SQL> alter user heera identified by foo; What happened? ----------------------------------------------------------------------------------19. Set the password verify function for the default profile for your database to null: SQL> alter profile default limit PASSWORD_VERIFY_FUNCTION null; ----------------------------------------------------------------------------------20. Now can you modify the HEERA user’s password to something not entirely secure: SQL> alter user heera identified by foo; ----------------------------------------------------------------------------------21. Lock and drop the HEERA account: SQL> alter user heera account lock; SQL> drop user heera cascade; What is the purpose of locking an account before it is dropped? ----------------------------------------------------------------------------------22. What is the purpose of a database profile? 11g book: page 123 12c book: page 141 ----------------------------------------------------------------------------------23. What is the purpose of a SQL profile? 11g book: (not covered in the class book) 12c book: (page 141) ----------------------------------------------------------------------------------24. Create a somewhat secure database profile. 11g book: pages 125-126 12c book: page 143 11g example: CREATE PROFILE SECURE_APP LIMIT PASSWORD_LIFE_TIME 200 PASSWORD_GRACE_TIME 10 PASSWORD_REUSE_TIME 1 PASSWORD_REUSE_MAX 1 FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 1 PASSWORD_VERIFY_FUNCTION verify_function_11G; 12c example: CREATE PROFILE SECURE_APP LIMIT PASSWORD_LIFE_TIME 200 PASSWORD_GRACE_TIME 10 PASSWORD_REUSE_TIME 1 PASSWORD_REUSE_MAX 1 FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 1 PASSWORD_VERIFY_FUNCTION ora12c_verify_function; ----------------------------------------------------------------------------------25. Connect as SYSTEM. Create a user named APP_USER and grant the user CONNECT: SQL> conn system/<password> SQL> create user app_user identified by foo ; SQL> grant create session to app_user; ----------------------------------------------------------------------------------26. Assign the SECURE_APP profile to APP_USER: SQL> alter user app_user profile secure_app; ----------------------------------------------------------------------------------27. Attempt to change the APP_USER password: SQL> alter user app_user identified by foofoo; What happens? Try a more secure password: SQL> alter user app_user identified by f00f00f00; ----------------------------------------------------------------------------------28. Enable your database to be able to constrain resources via a profile: SQL> show parameter resource_limit; If it’s not TRUE, then set it: SQL> alter system set resource_limit=true scope=both; ----------------------------------------------------------------------------------29. As SYSTEM, create a profile that limits system resource usage. 11g book: pages 127-128 12c book: page 146 create profile user_profile_limit limit sessions_per_user 20 cpu_per_session 240000 logical_reads_per_session 1000000 connect_time 480 idle_time 2; ----------------------------------------------------------------------------------30. Assign the profile to APP_USER: SQL> alter user app_user profile user_profile_limit; Verify: SQL> select username, profile from dba_users where profile like 'USER%'; ----------------------------------------------------------------------------------31. Connect as APP_USER: SQL> conn app_user/f00f00f00 Don’t type anything in for a few minutes. What happens after a few minutes of idle time? Try to run a SQL statement: SQL> select * from user_users; What happens? ----------------------------------------------------------------------------------32. Connect as SYSTEM, and modify the USER_PROFILE_LIMIT profile: SQL> conn system/<password> SQL> alter profile user_profile_limit limit idle_time 10; ----------------------------------------------------------------------------------33. Connect as APP_USER and attempt to create a table: SQL> conn app_user/f00f00f00 SQL> show user; SQL> create table emp(emp_id number); ----------------------------------------------------------------------------------34. Connect as SYSTEM, and grant some basic privileges to APP_USER: SQL> connect system/<password> SQL> grant create table to app_user; SQL> alter user app_user quota unlimited on users; ----------------------------------------------------------------------------------35. Connect as APP_USER and attempt to create a table: SQL> conn app_user/f00f00f00 SQL> show user; SQL> create table emp(emp_id number); SQL> describe emp; SQL> insert into emp values(1); ----------------------------------------------------------------------------------36. Connect as SYSTEM and create a new user named APP_MGMT: SQL> conn system/<password> SQL> create user app_mgmt identified by foo; SQL> grant connect to app_mgmt; SQL> grant create synonym to app_mgmt; SQL> alter user app_mgmt quota unlimited on users; ----------------------------------------------------------------------------------37. Connect as APP_USER and grant object privileges on the table EMP to APP_MGMT: SQL> conn app_user/f00f00f00 SQL> grant insert, update, delete, select on emp to app_mgmt; ----------------------------------------------------------------------------------- 38. Connect as APP_MGMT, and see if you can perform DML operations on the insert into app_user.emp values(1);APP_USER.EMP table: SQL> conn app_mgmt/foo SQL> insert into app_user.emp values(2); SQL> commit; SQL> select * from app_user.emp; Why do you have to place the schema name (of app_user) before the table name? ----------------------------------------------------------------------------------39. As APP_MGMT, create a synonym: SQL> select * from emp; What happens? SQL> create synonym emp for app_user.emp; SQL> select * from emp; Why don’t you have to place the schema name in front of the table name anymore? ----------------------------------------------------------------------------------39. Connect as SYSTEM and create a role: SQL> connect system/<password> SQL> create role app_read; SQL> grant select on app_user.emp to app_read; Now create a user and assign basic privileges and access to the role: SQL> create user app_select identified by foo; SQL> grant create session to app_select; SQL> grant app_read to app_select; ----------------------------------------------------------------------------------40. Connect as app_select and see if it has access to the underlying table: SQL> conn app_select/foo SQL> select * from app_user.emp; ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------Lab 2, Part 2: Tables and Constraints Read Chapter 7 in the book. ----------------------------------------------------------------------------------40. As SYSTEM, create a user and grant it appropriate privileges. SQL> conn system/<password> SQL> create user inv_user identified by inv_user_pwd; SQL> grant create session to inv_user; SQL> grant create table to inv_user; SQL> alter user inv_user quota unlimited on users; ----------------------------------------------------------------------------------41. Connect as INV_USER and create a heap-organized table that contains number, varchar, date, and timestamp type columns. 11g book: page 135 12c book: page 161 SQL> conn inv_user/inv_user_pwd create table d_sources( d_source_id number not null, source_type varchar2(32), create_dtt date default sysdate not null, update_dtt timestamp(5) ); ----------------------------------------------------------------------------------42. Does the table contain any segments and extents? SQL> select count(*) from user_segments where segment_name = 'D_SOURCES'; SQL> select count(*) from user_extents where segment_name = 'D_SOURCES'; ----------------------------------------------------------------------------------43. Insert a row into the D_SOURCES table. Verify that the data dictionary now contains information regarding segments and extents for the table. 11g book: pages 141-142 12c book: pages 167-168 SQL> insert into d_sources (d_source_id, source_type) values(1, 'HQ'); SQL> select count(*) from user_segments where segment_name = 'D_SOURCES'; SQL> select count(*) from user_extents where segment_name = 'D_SOURCES'; What is Oracle’s deferred segment creation feature? ----------------------------------------------------------------------------------44. As INV_USER, create two tables that are related by a foreign key constraint. 11g book: pages 136-138 12c book: page 198 create table operating_systems( operating_system_id number(19, 0) not null, version varchar2(50), os_name varchar2(256), release varchar2(50), vendor varchar2(50), create_dtt date default sysdate not null, update_dtt date, constraint operating_systems_pk primary key (operating_system_id) using index tablespace users ) tablespace users ; -create unique index operating_system_uk1 on operating_systems (os_name, version, release, vendor) tablespace users ; -create table computer_systems( computer_system_id number(38, 0) not null, agent_uuid varchar2(256), operating_system_id number(19, 0) not null, hardware_model varchar2(50), create_dtt date default sysdate not null, update_dtt date, constraint computer_systems_pk primary key (computer_system_id) using index tablespace users ) tablespace users; -comment on column computer_systems.computer_system_id is 'Surrogate key generated via an Oracle sequence.'; -create unique index computer_system_uk1 on computer_systems(agent_uuid) tablespace users; -alter table computer_systems add constraint computer_systems_fk1 foreign key (operating_system_id) references operating_systems(operating_system_id); ----------------------------------------------------------------------------------45. As INV_USER, verify that tables, indexes, constraints, and comments were created: SQL> select table_name, status from user_tables; SQL> select index_name, status, index_type from user_indexes; SQL> select constraint_name, constraint_type, table_name from user_constraints; SQL> select table_name, column_name, comments from user_col_comments where comments is not null; ----------------------------------------------------------------------------------46. As INV_USER, create a table with a virtual column. 11g book: pages 138-140 12c book: page 164 create table inv( inv_id number ,inv_count number ,inv_status generated always as ( case when inv_count <= 100 then 'GETTING LOW' when inv_count > 100 then 'OKAY' end) ); Verify: SQL> set long 10000; SQL> select dbms_metadata.get_ddl('TABLE','INV') from dual; ----------------------------------------------------------------------------------47. Insert data into INV, and verify that the virtual column works as expected: SQL> insert into inv (inv_id, inv_count) values (1,100); SQL> select * from inv; What are the main advantages to using virtual columns? ----------------------------------------------------------------------------------48. Make the INV table read only. 11g book: pages 140-141 12c book: page 167 SQL> alter table inv read only; Verify: SQL> select table_name, read_only from user_tables where read_only='YES'; Try to insert some data: SQL> insert into inv (inv_id, inv_count) values (2,200); ----------------------------------------------------------------------------------49. Drop and re-create table INV. Use the compression feature. 11g book: pages 143-144 12c book: page 172 SQL> drop table inv purge; create table inv( inv_id number ,inv_name varchar2(64) ) compress for oltp; Verify: select table_name ,compression ,compress_for from user_tables where table_name='INV'; ----------------------------------------------------------------------------------50. Drop and re-create a table with NOLOGGING enabled. 11g book: pages 144-145 12c book: page 174 SQL> drop table inv purge; create table inv(inv_id number) tablespace users nologging; Insert some data using a direct path feature (such as an append hint): SQL> insert /*+ append_values */ into inv values(1); SQL> select * from inv; What happened? SQL> commit; SQL> select * from inv; What are the advantages to using nologging combined with a direct path loading operation? ----------------------------------------------------------------------------------51. Create a table using the CTAS approach. 11g book: page 146 12c book: page 176 SQL> create table test_users as select * from all_users; SQL> desc test_users SQL> select count(*) from test_users; ----------------------------------------------------------------------------------52. Explain under what circumstances a DBA would use DDL_LOCK_TIMEOUT? 11g book: page 147 12c book: page 178 ----------------------------------------------------------------------------------53. Rename the INV table to INV_OLD. 11g book: page 147 12c book: page 179 SQL> rename inv to inv_old; Why would you want to rename a table? Rename INV_OLD to INV: SQL> rename inv_old to inv; ----------------------------------------------------------------------------------54. Add a columns to INV. 11g book: pages 147-148 12c book: page 179 SQL> alter table inv add(inv_count number); SQL> alter table inv add(inv_desc varchar2(10)); Verify: SQL> desc inv; ----------------------------------------------------------------------------------- 55. Alter a column. 11g book: pages 148-149 12c book: page 179 SQL> alter table inv modify inv_desc varchar2(256); Verify: SQL> desc inv; ----------------------------------------------------------------------------------56. Rename a column. 11g book: page 149 12c book: page 181 SQL> alter table inv rename column inv_count to inv_amt; Verify: SQL> desc inv; ----------------------------------------------------------------------------------57. Drop a column. 11g book: pages 149-150 12c book: page 181 SQL> alter table inv drop (inv_desc); Verify: SQL> desc inv; ----------------------------------------------------------------------------------58. Drop the INV table without purging it. 11g book: pages 151-153 12c book: page 183 SQL> drop table inv; Is it in the recyclebin? SQL> show recyclebin; ----------------------------------------------------------------------------------59. Undrop INV. 11g book: pages 151-153 12c book: page 184 SQL> flashback table inv to before drop; Verify: SQL> desc inv; Why would you ever want to undrop a table? ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------Lab 2, Part 3: Indexes Read Chapter 8 in the book. ----------------------------------------------------------------------------------60. Connect as INV_USER (if you’re not already connected as INV_USER): SQL> conn inv_user/inv_user_pwd ----------------------------------------------------------------------------------61. Verify that the d_sources table is still valid: SQL> desc d_sources; ----------------------------------------------------------------------------------62. Create an index. 11g book: pages 175-176. 12c book: page 210 SQL> create index d_sources_idx1 on d_sources(d_source_id); Verify: select index_name, index_type, table_name, tablespace_name from user_indexes where table_name = 'D_SOURCES'; ----------------------------------------------------------------------------------63. Drop the index: SQL> drop index d_sources_idx1; ----------------------------------------------------------------------------------64. Drop the INV table and re-create it. SQL> drop table inv purge; create table inv( inv_name varchar2(30) ,cust_name varchar2(30)); Verify: SQL> desc inv; ----------------------------------------------------------------------------------65. Create a concatenated index. 11g book: pages 176-177 12c book: page 217 SQL> create index inv_idx3 on inv(inv_name, cust_name); Verify: select index_name, column_name, column_position from user_ind_columns where index_name = 'INV_IDX3'; What is the advantage of creating a concatenated index? ----------------------------------------------------------------------------------66. Create a table named emp: SQL> create table emp(emp_id number, emp_name varchar2(30)); ----------------------------------------------------------------------------------67. Create a function based index. 11g book: page 177 12c book: page 218 SQL> create index user_upper_idx on emp(upper(emp_name)); Verify: SQL> SET LONG 500 SQL> select index_name, column_expression from user_ind_expressions; ----------------------------------------------------------------------------------68. Add a column to the INV table: SQL> alter table inv add(sku_id number); Verify: SQL> desc inv; ----------------------------------------------------------------------------------69. Create a unique index on INV.SKU_ID. 11g book: pages 178-179 12c book: page 219 SQL> create unique index inv_uidx1 on inv(sku_id); Verify: SQL> insert into inv(sku_id) values (1); SQL> insert into inv(sku_id) values (1); Verify via the data dictionary: SQL> select index_name, uniqueness from user_indexes; ----------------------------------------------------------------------------------70. Create a reverse-key index. 11g book: pages 181-182 12c book: page 222 SQL> alter table inv add(inv_id number); Verify: SQL> desc inv; SQL> create index inv_idx1 on inv(inv_id) reverse; Verify: SQL> select index_name, index_type from user_indexes; What is the main advantage of a reverse-key index? ----------------------------------------------------------------------------------71. Create a table and a key compressed index. 11g book: page 182 12c book: page 223 create table users( last_name varchar2(30) ,first_name varchar2(30) ,address_id number); SQL> create index users_idx1 on users(last_name, first_name) compress 2; Verify: select index_name ,compression from user_indexes where index_name like 'USERS%'; What is the advantage of compression? ----------------------------------------------------------------------------------72. Make an existing index an invisible index. 11g book: pages 183-185 12c book: page 224 SQL> select index_name, status, visibility from user_indexes; SQL> alter index inv_idx1 invisible; SQL> select index_name, status, visibility from user_indexes; Why would you ever want to use an invisible index? ----------------------------------------------------------------------------------73. Display the code to recreate in index. 11g book: page 188 12c book: page 227 SQL> set long 10000 SQL> select dbms_metadata.get_ddl('INDEX','INV_IDX1') from dual; ----------------------------------------------------------------------------------74. Rebuild an index using parallel and nologging. 11g book: pages 188-189 12c book: page 228 SQL> alter index inv_idx1 rebuild parallel nologging; DBAs often debate the merits of rebuilding an index. What are some valid reasons for rebuilding an index? ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------Lab 2, Part 4: Views, Synonyms, and Sequences Read Chapter 9 in the book. ----------------------------------------------------------------------------------75. Ensure that the CREATE VIEW system privilege, CREATE SYNONYM, and CREATE SEQUENCE system privilege has been granted to INV_USER. As SYSTEM: SQL> conn system/<password> SQL> grant create view to inv_user; SQL> grant create synonym to inv_user; SQL> grant create sequence to inv_user; ----------------------------------------------------------------------------------76. Connect as INV_USER and create a table. 11g book: pages 193-194 12c book: page 238 SQL> conn inv_user/inv_user_pwd create table sales( sales_id number primary key ,amnt number ,state varchar2(2) ); Verify: SQL> desc sales; ----------------------------------------------------------------------------------77. Create a view. 11g book: page 194 12c book: page 238 create or replace view sales_rockies as select sales_id ,amnt ,state from sales where state in ('GALWAY','CO','UT','WY','ID','AZ'); Verify: SQL> desc sales_rockies; ----------------------------------------------------------------------------------78. Experiment with inserting into the table versus the view: SQL> insert into sales values(1,500,'CO'); SQL> insert into sales values(2,500,'CA'); SQL> commit; SQL> select * from sales; SQL> select * from sales_rockies; What are the advantages to using view? ----------------------------------------------------------------------------------79. Is it possible to insert into a view? insert into sales_rockies( sales_id, amnt, state) values (3,300,'CO'); SQL> select * from sales_rockies; When you insert into a view, where is the underlying data actually stored? (in what database object?) ----------------------------------------------------------------------------------80. Recreate the view with the WITH CHECK OPTION. 11g book: pages 194-195 12c book: pages 239-240 create or replace view sales_rockies as select sales_id ,amnt ,state from sales where state in ('CORK','CO','UT','WY','ID','AZ') with check option; Run the following two update statements: SQL> update sales_rockies set state='ID' where sales_id=1; SQL> update sales_rockies set state='CA' where sales_id=1; Why did the first update work but not the second one? ----------------------------------------------------------------------------------81. Recreate the view as READ ONLY. 11g book: page 195 12c book: page 240 create or replace view sales_rockies as select sales_id ,amnt ,state from sales where state in ('KERRY','CO','UT','WY','ID','AZ') with read only; Now try to update it: SQL> update sales_rockies set state='ID' where sales_id=1; Why did it fail? ----------------------------------------------------------------------------------82. Generate the DDL required to recreate the view. 11g book: pages 198-199 12c book: page 245 SQL> set long 5000 SQL> select dbms_metadata.get_ddl('VIEW','SALES_ROCKIES','INV_USER') from dual; ----------------------------------------------------------------------------------83. Create a synonym for the sales_rockies view. 11g book: pages 200-201 12c book: page 248 SQL> create synonym sr_view for sales_rockies; Verify: SQL> desc sr_view ----------------------------------------------------------------------------------84. What is the difference between a private synonym and a public synonym? 11g book: pages 201-202 12c book: page 248 ----------------------------------------------------------------------------------85. Display synonym information contained in the data dictionary. 11g book: pages 202-203 12c book: page 250 select synonym_name, table_owner, table_name, db_link from user_synonyms order by 1; ----------------------------------------------------------------------------------86. Create a sequence using the defaults. 11g book: pages 204-206 12c book: page 251 SQL> create sequence inv_seq; ----------------------------------------------------------------------------------87. Create a sequence but specify some non-default values. 11g book: pages 204-206 12c book: page 251 SQL> create sequence inv2_seq start with 10000 maxvalue 1000000; ----------------------------------------------------------------------------------88. Use sequence pseudo column values. 11g book: pages 204-206 12c book: page 252 SQL> select inv_seq.nextval from dual; SQL> select inv_seq.currval from dual; ----------------------------------------------------------------------------------89. Verify the structure of the INV table: SQL> desc inv; Use a sequence to populate a column when inserting: insert into inv (inv_id) values (inv_seq.nextval); insert into inv (inv_id) values (inv_seq.nextval); insert into inv (inv_id) values (inv_seq.nextval); Verify: SQL> select * from inv; ----------------------------------------------------------------------------------90. Display the sequence metadata. 11g book: pages 208-209 12c book: page 255 SQL> select dbms_metadata.get_ddl('SEQUENCE','INV_SEQ') from dual; ----------------------------------------------------------------------------------91. In Oracle Database 12c, you can create an auto-incrementing column. What would be a typical use for an auto-incrementing column? ----------------------------------------------------------------------------------92. Make sure you shutdown your database. This frees up server resources for other students working on their labs. SQL> shutdown immediate; -----------------------------------------------------------------------------------