lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 12 On-line CPU(s) list: 0-11 Thread(s) per core: 2 Core(s) per socket: 6 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU E5-2643 v3 @ 3.40GHz Stepping: 2 CPU MHz: 1200.000 BogoMIPS: 6791.95 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 20480K NUMA node0 CPU(s): 0-11
Uncategorized
Oracle – Data Pump
expdp "\/ as sysdba\" SCHEMAS=xyz,abc ..... FLASHBACK_TIME=systimestamp SQL> select current_scn from v$database; expdp "\/ as sysdba\" SCHEMAS=xyz,abc ..... FLASHBACK_SCN=nnnnnnnnnn where nnnnnnnnnn = current_scn from the previous query
Oracle – Server Licensing Example
Oracle – Remove / Detach Home from Oracle Inventory
Must be done from an installed runInstaller (not from distribution) oracle@server1: ./runInstaller -silent -detachHome -invPtrLoc /etc/oraInst.loc ORACLE_HOME="/oracle/product/112_64/ORCL" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 10111 MB Passed The inventory pointer is located at /etc/oraInst.loc The inventory is located at /oracle/oraInventory 'DetachHome' was successful. Then, in the inventory.xml file, an entry will appear as follows:
Oracle, Linux – Huge Pages
12c in alert log
PAGESIZE AVAILABLE_PAGES EXPECTED_PAGES ALLOCATED_PAGES ERROR(s)
Tue May 24 11:47:24 2014
4K Configured 4 4 NONE
Tue May 24 11:47:24 2014
2048K 66805 1537 1537 NONE
Example from above log extract:
-- 12c calculation in alert log for huge pages
select 1537*(2048/1024/1024) from dual
-- = 1537 expected pages * Huge page Size (2048K) /1024/1024 to get GB = 3GB = sga_size init parameter
Oracle – Feature Usage
select * from DBA_FEATURE_USAGE_STATISTICS order by detected_usages desc;
SQL Server – SplitString Function
-- 100 recursions maximum
create function dbo.SplitString
(
@str nvarchar(max),
@separator char(1)
)
returns table
AS
return (
with tokens(p, a, b) AS (
select
cast(1 as bigint),
cast(1 as bigint),
charindex(@separator, @str)
union all
select
p + 1,
b + 1,
charindex(@separator, @str, b + 1)
from tokens
where b > 0
)
select
p-1 ItemIndex,
substring(
@str,
a,
case when b > 0 then b-a ELSE LEN(@str) end)
AS Item
from tokens
);
GO
SQL Server – Display Enterprise Edition Feature Usage
select * from sys.dm_db_persisted_sku_features;
Richard’s Page
SQL Server – Query all Databases
exec sp_msforeachdb
'use [?];
SELECT ''?'', MAX(TotalSpaceMB) as MaxObjSizeMB
FROM (
SELECT
t.NAME AS TableName,
i.name as indexName,
(sum(a.total_pages) * 8) / 1024 as TotalSpaceMB
FROM
sys.tables t
INNER JOIN
sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN
sys.allocation_units a ON p.partition_id = a.container_id
WHERE
t.NAME NOT LIKE ''dt%'' AND
i.OBJECT_ID > 255 AND
i.index_id <= 1
GROUP BY
t.NAME, i.object_id, i.index_id, i.name ) as Tab'
