ORACLE DBA USEFUL INFORMATION: Oracle partitioning interview questions

Oracle Partitioning Interview Questions and Answers
  • What is partitioning? …
  • Which objects can be partitioned?
  • What are the advantages of partitioning? …
  • What problems can occur in connection with partitioning?
  • How many types of partitioning exist?
  • What is the Oracle syntax for creating partitioned objects?

Partitioning in Oracle Explained with Real project Examples : Introduction

What is local and global index?

Local index is where the index is equipartitioned with its table, the index is partitioned on the same columns, with the same number of partitions and the same partition bounds as its table.

So each index partition is associated with exactly one partition of the underlying table, that is, all keys in an index partition refer only to rows stored in a single corresponding table partition. Local index can be subpartitioned.

Example for local index definition:

Global index is an index which is not local. It can be partitioned or non partitioned. If it is partitioned, then it is normally not equipartitioned with the table, a single index partition can point to any or all table partitions. (It is possible to create a global index which is equipartitioned with its table, but it does not make sense doing that as Oracle will not take advantage of the equipartitioning when generating query plans or executing partition maintenance operations.) The highest partition of a global index must have a partition bound that includes all values that are MAXVALUE. This insures that all rows in the underlying table can be represented in the index.

Global index cannot be subpartitioned. Note, you can create partitioned index on non partitioned table as well.

What is prefixed and non prefixed index?

The index is called prefixed if the leading column(s) in the index definition is (are) the partition key column(s), otherwise it is called non prefixed.

Note – If you want to store partition in same table space then remove table space values at time of creating partition.

Reduce the effect of index skew caused by an index on a column with a monotonically increasing value.

Use the CREATE DATABASE LINK statement to create a database link. A database link is a schema object in one database that enables you to access objects on another database. The other database need not be an Oracle Database system. However, to access non-Oracle systems you must use Oracle Heterogeneous Services.

1 – The ON COMMIT DROP DEFINITION clause, the default, indicates the table should be dropped at the end of the transaction, or the end of the session.

After you have created a database link, you can use it to refer to tables and views on the other database. In SQL statements, you can refer to a table or view on the other database by appending @dblink to the table or view name. You can query a table or view on the other database with the SELECT statement. You can also access remote tables and views using any INSERT, UPDATE, DELETE, or LOCK TABLE statement.

A reader, October 27, 2017 – 12:18 pm UTC Hi, Please have a look at below table partitions. TABLE_NAME PARTITION_NAME HIGH_VALUE —————– ———————- ———————————————————————————– TB_TEST_PARTITION TB_TEST_PARTITION_2009 TO_DATE( 2010-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2011 TO_DATE( 2012-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2012 TO_DATE( 2013-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2013 TO_DATE( 2014-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2014 TO_DATE( 2015-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2015 TO_DATE( 2016-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2016 TO_DATE( 2017-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) TB_TEST_PARTITION TB_TEST_PARTITION_2017 TO_DATE( 2018-01-01 00:00:00, SYYYY-MM-DD HH24:MI:SS, NLS_CALENDAR=GREGORIAN) I want to build a query which will give me partition less than 2013 (i.e. TB_TEST_PARTITION_2012, TB_TEST_PARTITION_2011, TB_TEST_PARTITION_2009) Problem which i am facing is all_tab_partitions.HIGH_VALUE is LONG datatype and its not allowing me to use any date function on it. Couls you please help how to modify below select condition to make it work. select a.owner, a.table_name, a.partitioning_type, t.partition_name, a.interval from all_part_tables a, all_tab_partitions t where a.owner in (SCOTT) and a.partitioning_type = RANGE and a.table_name not like BIN$% and a.interval is not null and t.table_owner = a.owner and t.table_name = TB_TEST_PARTITION and t.table_name = a.table_name —————————– and TO_CHAR((t.high_value – 1), YYYY) < 2013 ----------------------------- ;

FAQ

What are partitions in Oracle?

With Oracle Partitioning, a single logical object in the database is subdivided into multiple smaller physical objects, so-called partitions. The knowledge about this physical partitioning enables the database to improve the performance, manageability, or availability for any application.

How many partitions can an Oracle table have?

Tables can be partitioned into up to 64,000 separate partitions. Any table can be partitioned except those tables containing columns with LONG or LONG RAW datatypes.

What is partition by in Oracle query?

The PARTITION BY clause sets the range of records that will be used for each “GROUP” within the OVER clause. In your example SQL, DEPT_COUNT will return the number of employees within that department for every employee record.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *