Sunday, September 30, 2018

Parallel DDL and DML (create table as select)

For DDL :

create table APP_SCHEMA2.APP_TABLE2  parallel 15 as select  /*+ PARALLEL(A,15) */ * from  APP_SCHEMA1.APP_TABLE1 A ;

For DML :

Alter session enable parallel dml;

INSERT /*+ APPEND PARALLEL(A,60) */ into APP_USER2.APP_TABLE2 A
select /*+ PARALLEL(B,60) */ * from APP_USER1.APP_TABLE1 B ;

Tuesday, September 11, 2018

Best way to make make expdp/impdp faster

 EXPDP
============
=> Give more parallel as per allocated CPU
=> Exclude stats 
IMPDP
===========
=> create SQL file for Triggers and Indexes and modify parallel 1 to "parallel *" (as per your CPU)
=> Import metadata only (exclude index,stats)
=> Generate script to disable PK,FK constraints ( Do not generate script for check constraint)
=> Disable PK,FK constraints ( Do not disable check constraint)
=> import data_only ( parallel depends on CPU and dump files)
=> Create index and trigger in parallel (this will generate PK index also)
=> enable PK and FK constraints 
=> gather stats (or import stats)



Sunday, September 9, 2018

Microsoft SQL Server version number


SQL Server 2019 -> 15.0.X.X
SQL Server 2017 -> 14.0.X.X
SQL Server 2016 -> 13.0.X.X
SQL Server 2014 -> 12.0.X.X
SQL Server 2012 -> 11.0.X.X
SQL Server 2008 R2 -> 10.50.X.X
SQL Server 2008 -> 10.0.X.X
SQL Server 2005 -> 9.0.X.X


Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\ERRORLOG 
Select @@version 
SELECT
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('ProductUpdateLevel') AS ProductUpdateLevel,
SERVERPROPERTY('ProductBuildType') AS ProductBuildType,
SERVERPROPERTY('ProductUpdateReference') AS ProductUpdateReference,
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductMajorVersion') AS ProductMajorVersion,
SERVERPROPERTY('ProductMinorVersion') AS ProductMinorVersion,
SERVERPROPERTY('ProductBuild') AS ProductBuild
GO

More details :