Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Aioug vizag oracle12c_new_features

636 views

Published on

AIOUG Vizag Chapter TechDay June 18th 2016

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Aioug vizag oracle12c_new_features

  1. 1. Vinay Raj Malla Oracle DBA Miracle Software Systems Oracle Architecture & Oracle 12c New features
  2. 2. Agenda • Oracle Architecture. • Oracle 12c new features
  3. 3. Session objectives • Learn features of Oracle Database 12c that are not top, but would help you! • As a 11g DBA, what you should know when working with 12c database (changed behaviour or additional functionality) • Many features discussed at high level –once you know what to look for, “search” always works! (have <90 seconds for each feature)
  4. 4. Oracle 12c new features • READ Privilege (12.1.0.2) • Temporary Undo • Online Data File Move • Last Login Time • Cascaded TRUNCATE • Limit PGA • Listener Registration • More DB Writer Processes
  5. 5. • More DB Writer Processes • Faster (Approximate) Count –12.1.0.2 • Bigger VARCHAR2 • DDL Logging • Viewing DDL Log • Multi-threaded Processes • Invisible Columns • Row Limiting Clause Oracle 12c new features
  6. 6. • Connecting Lower Version Clients. • Database Express 12c. • Database Express home. • Data Pump NOLOGGING Import. • Data Pump Export Views As Tables • Datapump sqlfile • SQL*Loader Express Mode • RMAN Notables Oracle 12c new features
  7. 7. • RMAN Restore Table • RMAN Active Duplicate Using Backupset • RMAN Catalog Requires EE • Sqlcl Oracle 12c new features
  8. 8. Oracle Architecture
  9. 9. Oracle 12c enhancements
  10. 10. • READ Object Privilege, READ ANY TABLE system privilege • SELECT privilege also includes privilege to lock - LOCK TABLE <table_name> IN EXCLUSIVE MODE; - SELECT ... FROM <table_name> FOR UPDATE; • READ privilege is more secure, a true READ ONLY privilege! • Grants and Revokes work similar to SELECT grants. • No, there is no READ statement to go with the privilege, you still use the SELECT statement SQL> GRANT READ ON XX.XXLE_CUSTOMERS_T TO smith; SQL> GRANT READ ANY TABLE TO peter; SQL> REVOKE READ ON XX.XXLE_SUPPLIERS_VW FROM smith; SQL> REVOKE READ ANY TABLE FROM peter; SQL> REVOKE READ ANY TABLE FROM peter; READ Privilege (12.1.0.2)
  11. 11. Temporary Undo • By default, undo information on global temporary-table DML operations are stored in the undo tablespace, similar to undo operations on persistent tables.
  12. 12. • New parameter TEMP_UNDO_ENABLED • Undo information generated by DML operations on temporary tables stored in the temporary tablespace; therefore, no redo is generated for the undo operation. • Reduces the amount of undo data stored in the undo tablespaces, and the amount of redo from the undo. • Parameter is session modifiable -- Session level ALTER SESSION SET TEMP_UNDO_ENABLED = TRUE; ALTER SESSION SET TEMP_UNDO_ENABLED = FALSE; -- System level ALTER SYSTEM SET TEMP_UNDO_ENABLED = TRUE; ALTER SYSTEM SET TEMP_UNDO_ENABLED = FALSE; Temporary Undo
  13. 13. Online Data File Move • File move (rename) in 11g • Take tablespaceoffline • Use OS command to copy or move file –DBA does copy outside database • Use SQL to update the controlfile • ALTER DATABASE RENAME FILE or • ALTER TABLESPACE … RENAME DATAFILE • Bring tablespaceonline • To move files belonging the SYSTEM, do in MOUNT mode. • File move in 12c • Just one step – no unavailability! • ALTER DATABASE MOVE DATAFILE 'x' TO 'y' • The “TO” clause is optional –if omitted, file is moved to DB_CREATE_FILE_DEST as OMF.
  14. 14. More to File Move in 12c… • Files belonging to SYSTEM tablespace can be moved using ALTER DATABASE MOVE DATAFILE, online! • MOVE DATAFILE syntax allows only 1 file move at a time. You can still move multiple files with ALTER DATABASE RENAME FILE or ALTER TABLESPACE RENAME DATAFILE options –but offline mode. • File can be moved from file system to ASM disk group, and vice versa. • File can be moved from one diskgroup to another in ASM. • Optional KEEP clause to keep the data file at the source. • More to File Move in 12c…
  15. 15. Last Login Time Security related values in the USER$ table are [as existed in 11gR2]: • CTIME: Date & Time when user was created • PTIME: Date & Time when user password was last changed • LTIME: Date & Time when the user account was locked • LCOUNT: Number of failed login attempts • SPARE4: Encrypted case sensitive password 11g version • PASSWORD: Encrypted case insensitive password 10g version Added in Oracle Database 12c: • SPARE6: Last login time of the user. • Displayed when you invoke SQL*Plus • Last Login Time SQL>$ sqlplus hr/hr SQL*Plus: Release 12.1.0.1.0 Production on Tue Jul 9 23:34:32 2013 Copyright (c) 1982, 2013, Oracle. All rights reserved. Last Successful login time: Tue Jun 09 2016 23:34:22 -05:00 Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
  16. 16. Cascaded TRUNCATE • New CASCADE clause for TRUNCATE • Truncates all child tables that reference truncated table. • Foreign key must be defined with ON DELETE CASCADE option • Foreign key must be in ENABLED status. • Children, grand children are truncated • In Oracle Database 11gR2 and earlier versions, the TRUNCATE statement had the following two restrictions along with few others. • You cannot truncate the parent table of an enabled foreign key constraint. You must disable the constraint before truncating the table. An exception is that you can truncate the table if the integrity constraint is self-referential. • You cannot truncate the parent table of a reference-partitioned table. You must first drop the reference- partitioned child table.
  17. 17. Limit PGA • New parameter PGA_AGGREGATE_LIMIT • Specifies a limit on the aggregate PGA memory consumed by the instance • PGA_AGGREGATE_TARGET maintains the same behavior as 11g -specifies the target aggregate PGA memory available to all server processes attached to the instance.
  18. 18. Listener Registration • New mandatory background process LREG • Registers information about the database instance and dispatcher processes with the Oracle Net Listener • When an instance starts, LREG polls the listener to determine whether it is running. If the listener is running, then LREG passes it relevant parameters. If it is not running, then LREG periodically attempts to contact it. • Manual listener registration using ALTER SYSTEM REGISTER –same as in 11g. • In 11g, PMON process had this responsibility.
  19. 19. More DB Writer Processes • There can be up to 100 Database Writer Processes (configured using DB_WRITER_PROCESSES parameter). • The names of the first 36 Database Writer Processes are DBW0-DBW9 and DBWa- DBWz. • The names of the 37th through 100th Database Writer Processes are BW36- BW99. • Useful for systems that modify data heavily. • In 11gR2, the limit was 36.
  20. 20. Faster (Approximate) Count –12.1.0.2 • New function APPROX_COUNT_DISTINCT (<expr>) • Returns the approximate number of rows that contain distinct values of <expr>. • Alternative to the COUNT (DISTINCT <expr>) function, which returns the exact number of rows that contain distinct values of <expr>. • APPROX_COUNT_DISTINCT processes large amounts of data significantly faster than COUNT, with negligible deviation from the exact result. • SQL> SELECT APPROX_COUNT_DISTINCT (item_id) AS "Items Ordered" FROM order_lines;
  21. 21. Changing MAX_STRING_SIZE • ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE] • ALTER PLUGGABLE DATABASE OPEN UPGRADE • Change the setting of MAX_STRING_SIZE to EXTENDED • Run the ?/rdbms/admin/utl32k.sql script as SYSDBA. • ALTER PLUGGABLE DATABASE CLOSE • ALTER PLUGGABLE DATABASE OPEN
  22. 22. DDL Logging • ENABLE_DDL_LOGGING • Introduced in 11g • Writes DDL statements to Alert log • What’s different in 12c? • Instead of alert log, writes to DDL log directory in ADR • <ADR Home>/log/ddl • File log.xml • The Catch: • Either Database Lifecycle Management Pack or Change Management Pack must be licensed • DDL Logging $ cat log.xml <msgtime='2014-04-29T16:48:23.352-07:00' org_id='oracle' comp_id='rdbms' msg_id='opiexe:4181:2946163730' type='UNKNOWN' group='diag_adl' level='16' host_id='emcc.example.com' host_addr='10.0.2.15' version='1'> <txt>create table sample_test(n number) </txt> </msg>
  23. 23. Viewing DDL Log • Use adrci: New option –SHOW LOG • Default shows all logs –ddl, debug and test • Filter ddllogs using –l. Further filter using the –p option • Try “help show log” to see all predicate string options with -p • Viewing DDL Log • adrci> show log -l ddl-p "message_textlike '%sampl%'" ADR Home = /u02/app/oracle/diag/rdbms/ocadb1/ocadb1: **************************************************************** Output the results to file: /tmp/utsout_4170_140592_1.ado adrci> 2016-04-29 16:48:23.352000 -07:00 create table sample_test(n number) 2016-06-09 16:48:31.853000 -07:00 drop table sample
  24. 24. Multi-threaded Processes • New Parameter: THREADED_EXECUTION (YES/NO) • Allows multiple background processes to share a single OS process on Unix, similar to Windows. • In default process models, SPID and STID columns of V$PROCESS will have the same values, whereas in multithreaded models, each SPID (process) will have multiple STID (threads) values. • The EXECUTION_TYPE column in V$PROCESS will show THREAD. • V$BGPROCESS shows the background processes. • Listener.ora should have DEDICATED_THROUGH_BROKER_<listener-name>=ON • Cannot Login ‘/ AS SYSDBA’ • Must use SYS AS SYSDBA
  25. 25. Invisible Columns • Columns can be invisible (ALTER TABLE, CREATE TABLE syntax –INVISIBLE) • Not supported on temporary and external tables • Specify explicitly in INSERT, SELECT clauses • SQL*Plus: SET COLINVISIBLE ON When you make an INVISIBLE column in Oracle 12c database to VISIBLE, the COL# is assigned the highest available. Thus the column becomes the last column in the table (not storage, only display). So, if you accidentally make a column INVISIBLE and correct it by changing to VISIBLE, the column order changes. So, if the application uses "SELECT *" or "INSERT" without column names, they might break!
  26. 26. • New clause in SELECT statement • Follows the ORDER BY clause • [ OFFSET offset{ ROW | ROWS } ] • [ FETCH {FIRST | NEXT} [ {rowcount| percent PERCENT} ] • { ROW | ROWS } { ONLY | WITH TIES } ] • OFFSET clause is used to skip the specified number of rows before the limiting begins. • FETCH clause can specify the number of rows to return or a percentage of rows to return. • ONLY specifies to return exact number or percent of rows to return. • WITH TIES specifies to return all rows that have the same sort keys as the last row of the row-limited result set. Row Limiting Clause
  27. 27. Row Limiting Examples
  28. 28. Security Defaults • AUDIT_SYS_OPERATIONS defaults to TRUE in #Oracle12c • AUDIT_ADMIN and AUDIT_VIEWER Security Roles • utlpwdmg.sql script creates ora12c_verify_function and ora12c_strong_verify_function • RESOURCE Role No Longer Grants the UNLIMITED TABLESPACE Privilege • Default Unified Audit Policy Enabled. Failed logins are written to UNIFIED_AUDIT_TRAIL. • The ORA_LOGON_FAILURES unified audit policy for new databases, tracks failed logons only. • AUDSYS schema will be used solely for storage of the unified audit trail data table.
  29. 29. Connecting Lower Version Clients • SQLNET.ALLOWED_LOGON_VERSION_CLIENT • SQLNET.ALLOWED_LOGON_VERSION_SERVER • Replaced SQLNET.ALLOWED_LOGON_VERSION
  30. 30. Database Express 12c • Database Control is history… • Requires XDB. EM Express is a servlet built on top of Oracle XML DB. • Deafultport is 5500, can be changed using DBMS_XDB_CONFIG.setHTTPsPort(<port>) procedure • URL is https://<hostname>:5500/em • Available only when the database is open • The EM_EXPRESS_BASIC role enables users to connect to EM Express and to view the pages in read-only mode. • The EM_EXPRESS_ALL role enables users to connect to EM Express and use all the functionality. • While creating Oracle Database 12c database, DBCA picks a free port from 5500 to 5599 for Enterprise Manager Express. If you want a specific port to be used, set the environment variable DBEXPRESS_HTTPS_PORT before starting Oracle Universal Installer (OUI) or Database Configuration Assistant (DBCA).
  31. 31. DB Express Home
  32. 32. Data Pump NOLOGGING Import • Import without generating archived logs • TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y[:TABLE|INDEX] • Sets object to NOLOGGIG before import and reverts to original setting after import. • Choose to disable logging for tables (Y:TABLE), indexes (Y:INDEX), or both (Y). • $ impdp DIRECTORY=dump_dirDUMPFILE=ex2.dmp LOGFILE=ex2.log SCHEMAS=ball TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y:TABLE • $ impdp DIRECTORY=dump_dirDUMPFILE=ex1.dmp LOGFILE=ex1.log SCHEMAS=basket TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y TRANSFORM=DISABLE_ARCHIVE_LOGGING:N:INDEX This feature provides a great relief when importing large tables, and reduces the excessive redo generation, which results in quicker imports. This attribute applies to tables and indexes.
  33. 33. Data Pump Export Views As Tables • Export one or more views as tables • VIEWS_AS_TABLES=[schema_name.]view_name[:table_name], ... • Table_name specifies the name of a table to serve as the source of the metadata for the exported view. • Data Pump performs a table-mode export. • Useful to get a subset of data exported. • Also available in “impdp” to use in the network mode of import.
  34. 34. SQL*Loader Express Mode • SQL*Loader in #DB12c has a new option that does not require the user to create a SQL*Loader control file. • Instead, command-line parameters are used to specify how the data file is loaded, and SQL*Loader automatically chooses the best method with which to load the data. • Data files formatted as comma-separated values (CSV) to both SQL*Loader and external tables are supported. • The new parameter, TABLE, turns on express mode. The value of the TABLE parameter is the name of the table that SQL*Loader will load. • If no data file is specified, then looks for file namedtablename.dat in the current directory • Sqlldr username TABLE=EMPLOYEES
  35. 35. RMAN Notables • “Describe” in RMAN, similar to SQL*Plus. • Most SQL statements can be run in RMAN without the “SQL” prefix (and messing with quotes around the SQL!!). • SYSBACKUP Administration Role –Start replacing scripts where SYSDBA is used. RMAN> SELECT username,machine FROM v$session; RMAN> ALTER TABLESPACE users ADD DATAFILE SIZE 121m;
  36. 36. RMAN Restore Tables • The biggest RMAN feature is restore table from backup. RMAN>RECOVER TABLE SCOTT.EMP, SCOTT.DEPT UNTIL TIME 'SYSDATE-1' AUXILIARY DESTINATION '/t1/tdb' DATAPUMP DESTINATION '/t1/dump' DUMP FILE 'emp_dept_dump.dat' REMAP TABLE 'HR'.'EMP':'EMP_RECVR'; --NOTABLEIMPORT; • When NOTABLEIMPORT option is used, RMAN performs the restore/recover and creates the export dump file, but does not perform the import.
  37. 37. RMAN Catalog Requires EE • Starting with 12c, the RMAN catalog database requires Enterprise Edition. • Covered under the Infrastructure Repository License (no need for additional license). • RMAN • Oracle Enterprise Manager Cloud Control • Automatic Workload Repository (AWR) Warehouse • Global Data Services Catalog • Grid Infrastructure Management Repository • https://blogs.oracle.com/UPGRADE/entry/rman_catalog_requires_ee_in • http://docs.oracle.com/database/121/DBLIC/editions.htm#DBLIC119
  38. 38. Database upgrade improvements • A new and much improved pre-upgrade information script, preupgrd.sql, replaces the legacy utlu[121]s.sql script in 12c R1. • Apart from the preupgrade checks verification, the script is capable of addressing the various issues – in the form of fixup scripts – that are raised during the pre- post upgrade process.
  39. 39. DB In-memory
  40. 40. In-Memory Scan speed
  41. 41. Sqlcl features  Alias  CD : allow you to change path once connected to SQLcl, it seems that relatives path are not supported.
  42. 42. • CTAS • DDL, DDL >sql • INFO/INFO+ • FORMAT FILE • HISTORY • LOAD • set sqlformat csv/ XML/json/insert/ansiconsole.. Sqlcl features
  43. 43. References • https://docs.oracle.com/database/121/NEWFT/chapter12102.htm#N EWFT003 • Biju Thomas Blog • http://oracleinaction.com/undo-and-redo-in-oracle/ • https://oracle-base.com/articles/12c/articles-12c
  44. 44. Thank You

×