Search This Blog

Total Pageviews

Thursday, 23 November 2023

Oracle Schema Size

Oracle schema size  ... 



DEFINE schema_name = 'XXXX'
set linesize 300

col schema_size_gb  for 9999999.99

SELECT sum(sizegb) schema_size_gb FROM (
-- tablesize !!!
--SELECT *  FROM (
SELECT
owner, object_name, object_type, table_name, ROUND(bytes)/1024/1024/1024 AS sizegb,tablespace_name, extents, initial_extent,
ROUND(Sum(bytes/1024/1024) OVER (PARTITION BY table_name)) AS total_table_MB
FROM (
-- Tables
SELECT owner, segment_name AS object_name, 'TABLE' AS object_type,segment_name AS table_name, bytes,tablespace_name, extents, initial_extent
FROM dba_segments
WHERE segment_type IN ('TABLE', 'TABLE PARTITION', 'TABLE SUBPARTITION')
UNION ALL
-- Indexes
SELECT i.owner, i.index_name AS object_name, 'INDEX' AS object_type,i.table_name, s.bytes,s.tablespace_name, s.extents, s.initial_extent
FROM dba_indexes i, dba_segments s
WHERE s.segment_name = i.index_name
AND s.owner = i.owner
AND s.segment_type IN ('INDEX', 'INDEX PARTITION', 'INDEX SUBPARTITION')
--LOB Segments
UNION ALL
SELECT l.owner, l.column_name AS object_name, 'LOB_COLUMN' AS object_type,l.table_name, s.bytes,s.tablespace_name, s.extents, s.initial_extent
FROM dba_lobs l, dba_segments s
WHERE s.segment_name = l.segment_name
AND s.owner = l.owner
AND s.segment_type = 'LOBSEGMENT'
-- LOB Indexes
UNION ALL
SELECT l.owner, l.column_name AS object_name, 'LOB_INDEX' AS object_type,l.table_name, s.bytes,s.tablespace_name, s.extents, s.initial_extent
FROM dba_lobs l, dba_segments s
WHERE s.segment_name = l.index_name
AND s.owner = l.owner
AND s.segment_type = 'LOBINDEX'
)
WHERE owner in UPPER('&schema_name')
)
--WHERE total_table_MB > 10
--ORDER BY total_table_MB DESC, MB DESC
/


====


with count 

set linesize 100 pagesize 200 
col Owner for a28
select obj.owner "Owner", obj_cnt "Objects",decode(seg_size, NULL, 0, seg_size) "size GB"
from ( select owner, count(*) obj_cnt from dba_objects group by owner) obj,
     ( select owner, ceil(sum(bytes)/1024/1024/1024) seg_size from dba_segments group by owner) segment
where obj.owner = segment.owner(+)
order by 3 desc, 2 desc, 1;

Monday, 13 November 2023

Licensing Data Recovery Environments ( Oracle Licensing DataGaurd )



Oracle Licensing DataGaurd 

From Web 

Licensing Data Recovery Environments

 


In today's data and information intensive economy, businesses need continuous access to mission-critical information. IT departments must not only manage the rapid growth of business information but they must also 
keep this information available and protected. That's why every business has data recovery and business continuance plans. This document will help you in understanding how to license Oracle programs in 
such environments.

Data Recovery environments are usually deployed using the following two methods: a) Deploying a clustered environment such as Failover or b) Copying, Synchronizing or Mirroring of the data and/or program files 
(such as Physical DB files, Binaries, Executables).

Data Recovery using Clustered Environments (Failover)

The failover data recovery method is an example of a clustered deployment, where multiple nodes/servers have access to one Single Storage/SAN. In such cases your license for the programs listed on the US Oracle 
Technology Price List (http://www.oracle.com/corporate/pricing/pricelists.html) is eligible for the 10-day rule, which includes the right to run the licensed program(s) on an unlicensed spare computer in a failover environment for up to a total of ten separate 24-hour periods in any given calendar year (for example, if a failover node is down for two hours on Tuesday and three hours on Friday, it counts as two 24-hour periods). 
The above right only applies when a number of physical or logical machines as defined in Oracle's Partitioning Policy (detailed in https://www.oracle.com/assets/partitioning-070609.pdf) are arranged in a cluster 
and share one logical disk array located in a single data center. When the primary node fails, the failover node acts as the primary node. Once the primary node is repaired, you must either switch back or 
designate that repaired server as the failover node. Once the failover period has exceeded ten 24-hour periods, the failover node must be licensed. In addition, only one failover node per clustered 
environment is at no charge even if multiple nodes are configured as failover. Downtime for maintenance purposes counts towards the ten separate 24-hour periods limitation. When licensing 
options on a failover environment, the options must match the number of licenses of the associated database. Additionally,when licensing by Named User Plus, the user minimums are waived on one failover node only. 
Any use beyond the right granted in this section must be licensed separately. In a failover environment, the same license metric must be used for the production and failover nodes when licensing a given clustered configuration.

Data Recovery Environments using Copying, Synchronizing or Mirroring
Standby and Remote Mirroring are commonly used terms to describe these methods of deploying Data Recovery environments. In these Data Recovery deployments, the data, and optionally the Oracle binaries, 
are copied to another storage device. In these Data Recovery deployments all Oracle programs that are installed and/or running must be licensed per standard policies documented in the Oracle
Agreement. This includes installing Oracle programs on the DR server(s) to test the DR scenario.

Licensing metrics and program options on Production and Data Recovery servers must match with two exceptions: 1) Real Application Clusters (RAC) - Oracle RAC does not need to be licensed on the Data

Recovery server unless used on the Data Recovery server; 2) For Production servers licensed using one of
the Oracle Data Management Cloud Services listed in this document

(http://www.oracle.com/us/corporate/contracts/paas-iaas-universal-credits-3940775.pdf), only

program options in use on the Production server must be licensed on the Data Recovery server.

This document is for educational purposes only and provides guidelines regarding Oracle's Data Recovery policies in effect as of July 28th, 2020. It may not be incorporated into any contract and does 
not constitute a contract or a commitment to any specific terms. Policies and this document are subject to change without notice. This document may not be reproduced in any manner without the express written 
permission of Oracle Corporation.

Testing
For the purpose of testing physical copies of backups, your license for the Oracle Database includes the right to run the database on an unlicensed computer for up to four times, not exceeding 2 days per testing, in any given calendar year. The aforementioned right does not cover any other data recovery method - such as remote mirroring - where the Oracle program binary files are copied or synchronized.




Saturday, 11 November 2023

Oracle 23c SET ERRORDETAILS on

SET ERRORDETAILS on




SQL> SET ERRORDETAILS on
SQL> conn /@FREEPDB1 as sysdba
ERROR:
ORA-01017: invalid credential or not authorized; logon denied
Help: https://docs.oracle.com/error-help/db/ora-01017/    <<<< to trun off this 




SQL> SET ERRORDETAILS off
SQL> conn /@FREEPDB1 as sysdba
ERROR:
ORA-01017: invalid credential or not authorized; logon denied


Warning: You are no longer connected to ORACLE.
SQL>


******

https://docs.oracle.com/en/database/oracle/oracle-database/23/sqpug/sqlplus-users-guide-and-reference.pdf   pageno 266  !!!!

In the following example, the variable ERRORDETAILS is set to ON:
SET ERRORDETAILS ON
SELECT * FROM EMP;
SP2-0640: Not connected
Help: https://docs.oracle.com/error-help/db/sp2-0640/



[oracle@localhost admin]$ export TWO_TASK=''
[oracle@localhost admin]$ echo $TWO_TASK

[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Sep 18 09:39:00 2024
Version 23.3.0.23.09

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL>

Oracle DBA

anuj blog Archive