Wednesday, October 28, 2009

My Dogs Ringworm Is Not Healing

Change http port of Oracle XE EM - (XE: Changing the default http port)

Determine the current configuration settings on your Oracle XE. Accessed through SQLPLUS with SYSTEM user (or anyone else with DBA privileges):
 
C: \\ WINDOWS \\ system32> sqlplus system @ xe SQL * Plus

: Release 10.1.0.2.0 - Production on Mi Jan 25 November : 44:33 2006

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

Enter password: Connected to

:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta SQL

> -
get current status SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb. getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- ---------- 8080 0


You can change the HTTP port and the port of FTP when you want only have a few precautions such as
  • Note that you need special privileges for <1024>
  • ports should check the ports used ( netstat -ano )
  • httpport the parameter defines the port that will run the MS.

 
SQL> - set port http and ftp port
SQL> begin 2
dbms_xdb.sethttpport ('80 '); - The value 80 is the new parameter
3 dbms_xdb.setftpport ( '2100 ') ; - The value 80 is the new parameter
4 end;
5 /

PL / SQL procedure successfully completed.

SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
---------- --- 80 2100 -------


If you only want to use the database without allowing access through HTTP or FTP, you can disable these options as follows:

 
SQL> - disable http and ftp access
SQL> begin 2 dbms_xdb.sethttpport
('0 ');
3 dbms_xdb.setftpport ('0');
4 end;
5 /

PL / SQL procedure successfully completed.

SQL> -
get current status SQL> select dbms_xdb.gethttpport as "HTTP-Port"
, dbms_xdb.getftpport as "FTP-Port" from dual;

HTTP-Port FTP-Port
----- ----- ---------- 0 0

Tuesday, October 27, 2009

Uncontrollable Bladder What To Do

BULK COLLECT with thousands of records and the LIMIT clause


I see many times that when using BULK COLLECT in PL / SQL code, not put the LIMIT clause. When we do not use this clause, all you win is to ruin the memory of the process.
The LIMIT clause allows us to define the amount of 'data' which we will place in memory. When use LIMIT, the ideal is to define a value between 100 to 500. Personally, I choose the value 100 because in my experience is usually the best value. But because I choose a value so small and not 1000 or 5000 for example? Well, for the simple reason that handle large amounts of data in memory is more expensive to handle small quantities.
If you choose a high value on the edge, can be 3 cases:
- that your code will run faster (unlikely).
- that your code will run in the same time (unlikely).
- that your code will run slower (likely).

An example to better understand the consequences of not using the LIMIT clause.

TEST First, create a table with 10,000 records (to see the difference in the use of the LIMIT clause, you do not run the example with millions of records. With thousands of records about us enough to understand the issue) and a table with TEST_2 TEST table structure but no records:
 
SQL_9iR2> CREATE TABLE test AS SELECT level
2 id, 'oracle_' not being used in my current session in order to see clearly the difference in the statistics taken in each run.

<= 10000 ;
SQL_9iR2> exec dbms_session.FREE_UNUSED_USER_MEMORY;

PL / SQL procedure successfully completed.


execute a PL / SQL Bulk Collect but WITHOUT LIMIT clause:


SQL_9iR2> DECLARE 2 TYPE t_array_number
IS TABLE OF NUMBER;
3 t_array_varchar2 TYPE IS TABLE OF VARCHAR2 (50);
4 t_array_id t_array_number; 5 t_array_texto
t_array_varchar2;
 6 7 
CURSOR cur IS SELECT * FROM test;

8 BEGIN 9 OPEN cur;
10 LOOP 12 FETCH
11
cur BULK COLLECT INTO t_array_id, t_array_texto;
 13 14 FORALL i IN 1 .. INSERT INTO 
t_array_id.COUNT test_2
15 16 VALUES (t_array_id (i) t_array_texto (i));
17
18 EXIT WHEN cur% NOTFOUND;

19 20 END LOOP;
21 COMMIT;
22 CLOSE cur;
23 END;
24 /

PL / SQL procedure successfully completed.

Elapsed: 00:00:00.04


Before running the second code, I will release the memory again and not being used in my current session.


SQL_9iR2> exec dbms_session.FREE_UNUSED_USER_MEMORY ;

PL / SQL procedure successfully completed.


Now run the same code PL / SQL Bulk Collect with LIMIT clause but WITH:


SQL_9iR2> DECLARE 2 TYPE t_array_number
IS TABLE OF NUMBER;
3 t_array_varchar2 TYPE IS TABLE OF VARCHAR2 (50);
4 t_array_id t_array_number;
5 t_array_texto t_array_varchar2;
 6 7 
CURSOR cur IS SELECT * FROM test;

8 BEGIN 9 OPEN cur;
11 10 LOOP 12 FETCH
cur BULK COLLECT INTO t_array_id, t_array_texto
 LIMIT 100; 
13
14 FORALL i IN 1 .. INSERT INTO
t_array_id.COUNT 15 test_2
16 VALUES (t_array_id (i) t_array_texto (i));
17
18 EXIT WHEN cur% NOTFOUND;

19 20 END LOOP;
21 COMMIT;
22 CLOSE cur;
23 END;
24 / PL / SQL procedure successfully completed.

Elapsed: 00:00:00.04


We see that in the second run, I'm loading into memory on each fetch 100 records that I do. Unlike the first implementation, which loads all the data at once. Let

statistics from the previous 2 versions:


Name Ejecución_1 Ejecución_2
Difference ------------------------------ ----------- ----------- -----------
LATCH.kwqit: protect wakeup ti 1 0 -1
LATCH.simulator lru latch 1 0 -1
LATCH.spilled msgs queues list 1 0 -1
LATCH.transaction allocation 3 0 -3
LATCH.session timer 5 0 -5
LATCH.multiblock read objects 8 0 -8
LATCH.channel operations paren 11 0 -11
LATCH.child cursor hash table 20 8 -12
LATCH.Consistent RBA 56 6 -50
LATCH.lgwr LWN SCN 56 6 -50
LATCH.mostly latch-free SCN 56 6 -50
 LATCH.active checkpoint queue           63           7         -56 
LATCH.session idle bit 183 45 -138
LATCH.enqueues 219 49 -170
LATCH.redo writing 241 25 -216
LATCH.SQL memory manager worka 337 0 -337
LATCH.messages 427 42 -385
LATCH.simulator hash latch 844 4 -840
LATCH.dml lock allocation 1,428 154 -1,274
LATCH.shared pool 1,586 271 -1,315
LATCH.row cache enqueue latch 1,648 194 -1,454
LATCH.cache buffers lru chain 1,521 5 -1,516
LATCH.library cache pin alloca 2,900 362 -2,538
LATCH.row cache objects 4,438 502 -3,936
LATCH.enqueue hash chains 4,841 508 -4,333
LATCH.checkpoint queue latch 6,296 521 -5,775
LATCH.session allocation 19,333 1,893 -17,440
LATCH.undo global data 30,208 2,945 -27,263
LATCH.redo allocation 30,716 3,231 -27,485
LATCH.sequence cache 42,506 4,124 -38,382
LATCH.library cache pin -54.339 60.580 6.241 76.555 7.911
LATCH.library cache -68.644

Latch:


Ejecución_1 Ejecución_2 Percentage Difference
670.187 67.521 -602.666 992.56%



One of the things that interests me show you about these executions are LATCH (loquee). Although the implementation of the 2 PL / SQL code delayed to run the exact same thing (in this example, processing only 10,000 records), statistics show us that we lock for many more employees in the first execution in the second. But why does this happen? Recall that in the second run, all that changed in the code was the addition of the LIMIT clause. Well, as we said at the start, manage large amount of memory is more costly to handle short supply, so Oracle has to use much to handle loquee we climbed to 10,000 records in the first implementation report, which handle only 100 records in the second run.
This example is conducted with a concurrent user only .... but imagine what would happen if we have many concurrent users doing the same thing we ... and therefore, generating lots of loquee ....

NOTE: We must avoid at all costs and lock for that los loqueos afectan la performance del sistema. Mientras mayor sea la cantidad de loqueos, nuestro sistema se vuelve cada vez menos escalable; y como consecuencia, cada vez soporta menor cantidad de usuarios concurrentes.



How Do I Know If I Am A Will Beneficiary

Partitioned Tables - Command 'EXCHANGE'








Exchange Partition
En resumen, lo que hace la sentencia Exchange Partition es modificar el diccionario de datos y simular que los datos que ya tenemos cargados en una tabla, corresponden a una partición determinada de otra table.
Here is a simple example to better understand this topic:

SQL_10gR2> CREATE TABLE AS
data_1 level 2 SELECT id, timestamp'2000-11-02 9:00:00 'date

3 FROM dual 4 CONNECT BY
level data_2 CREATE TABLE AS SELECT level 2 id, timestamp'2001-9-10 13:00:00 'date 3 FROM dual 4 CONNECT BY level


What we did was create 2 tables with different dates in each of them.

Now create only the structure of the partitioned table where we will load the data:
 
SQL_10gR2> CREATE TABLE test
2 (id, date) PARTITION BY RANGE
3 (date)
4 (5 <= 100000 ; Table created. Elapsed: 00:00:01.06 SQL_10gR2> year_2000 PARTITION VALUES LESS THAN (timestamp'2000-12-02 00:00:00 '),
6 year_2001 PARTITION VALUES LESS THAN (timestamp'2001-10-10 00:00:00')
7)
<= 100000 ; Table created.
8 AS 9 SELECT 1, timestamp'2000-11-02 9:00:00 '

11 10 FROM dual WHERE 1 = 0;

 We will make an alter to change the data dictionary and relate each of the 2 tables with the respective partition create table TEST ... 


SQL_10gR2> ALTER TABLE test 2


year_2000
EXCHANGE PARTITION 3 with table 4
data_1

WITHOUT VALIDATION;

Table altered.


Elapsed: 00:00:00.03
  

SQL_10gR2> ALTER TABLE test 2 EXCHANGE PARTITION
year_2001
3 WITH table datos_2 4 WITHOUT VALIDATION
;

Table altered.
Elapsed: 00:00:00.02


SQL_10gR2> SELECT count(*) 2 FROM test ;
COUNT(*)
---------- 200000
1 row selected.

SQL_10gR2> SELECT count(*)
2 FROM datos_1 ; COUNT(*)
----------
0

1 row selected.

SQL_10gR2> SELECT count(*)
2 FROM datos_2 ;

COUNT(*)

0

---------- 1 row selected.


As we can see with Partition Exchange does not take us almost nothing to load the data into the partitioned table because we're not loading the data, simply adjust the data dictionary.

may notice that I added the sentence WITHOUT VALIDATION. What is this? WITHOUT VALIDATION usually a fast operation because it only modifies the data dictionary. If the partitioned table or placed in the Exchange Partition has a primary key or unique constraint enabled, then the Partition Exchange VALIDATION WITH done as to maintain the integrity of the constraints. Let

rerun the 2 previous alter without judging WITHOUT VALIDATION ...


SQL_10gR2> ALTER TABLE test 2


year_2000
EXCHANGE PARTITION 3 with table data_1;
Table altered.


Elapsed: 00:00:01.00


SQL_10gR2> ALTER TABLE test 2
 

year_2001 EXCHANGE PARTITION 3 with table data_2;
Table altered.


Elapsed: 00:00:01.05

If I run these alter with Trace, the Trace report I show, among other rulings, the following ...

select 1 from
"data_1" where TBL$OR$IDX$PART$NUM("TEST", 0, 3,1048576,"FECHA") != :1

call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.00 0.00 0 1 0 0 Fetch 1 0.04 0.04 0 65 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------

total 3 0.04 0.04 0 66 0 0
  
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 81 (recursive depth: 1)

Rows Row Source Operation
------- ---------------------------------------------------
0 TABLE ACCESS FULL DATOS_1 (cr=65 pr=0 pw=0 time=44582 us)


select 1 from "DATOS_2" where TBL$OR$IDX$PART$NUM("TEST", 0, 3,1048576,"FECHA") != :1

call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 1 0 0
Fetch 1 0.04 0.04 0 65 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------

total 3 0.04 0.04 0 66 0 0


Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 81 (recursive depth: 1)

Rows Row Source Operation
------- ---------------------------------------------------
0 TABLE ACCESS FULL DATOS_2 (cr=65 pr=0 pw=0 time=46957 us)


Antes que nothing, we note that the alternative is implemented in more time, right? From the consultations we observed the Trace, we see that it is conducting a FULL SCAN of the tables and that is running a function in the WHERE of each query. Imagine if we have to make this kind of processes in environments with large volumes of data and wherein the system is saturated by the I / O to disk. What happens if we do not have the data separated by year in different tables, and instead have all the data in one table? Well, as exemplified by the table TEST just to load, could do the following ...


SQL_10gR2> CREATE TABLE test_2
2 (id, date)
3 PARTITION BY RANGE ( fecha )
4 (
5 PARTITION year_2000 VALUES LESS THAN ( timestamp'2000-12-02 00:00:00' ),
6 PARTITION year_2001 VALUES LESS THAN ( timestamp'2001-10-10 00:00:00' )
7 )
8 AS
9 SELECT *
10 FROM test ;

Table created.
 Elapsed: 00:00:05.04 

SQL_10gR2> DROP TABLE test ;

Table dropped.

SQL_10gR2> ALTER TABLE test_2 RENAME TO test ;

Table altered.

SQL_10gR2> SELECT count(*)
2 FROM test ;

COUNT(*)
----------
200000

1 row selected.





Wednesday, September 16, 2009

Counter Strike Source -heapsize Launch Options

--- Oracle 11g R2 Released base


After months of testing, today I release the final version of Oracle 11g R2 (11.2.0.1) for Linux (32 and 64 bit), this version brings more than 200 new features highlighting the new ASM FileSystem, improved understanding and more. You can find more information and download the software at:


http://www.oracle.com/database/index.html


A big hello to all

Monday, August 31, 2009

Colours To The Shag Bands

Copy Windows data in LogMiner

The request was

When the database can keep the same name and same SID is as easy as copying datafiles, redo, ControlFiles ORA files and directories on the same original on a machine with an Oracle server installed

*

.

* Of course, same OS platform, version and release of Oracle.

This example assumes that you have the possibility of doing a cold backup of the database. Preliminary Steps

(recommended) :
- Backup cold, hot backup, export, Transport Tablespaces, backup, backup, backup of everything. - Reduction in size of the datafiles. (Tom Kyte has a fabulous script for it). Again backup.
Steps: 1 .-


Cold Backup of original DB

2 .- generation of new DB for pfile 3 .- Edit the pfile to replace: control_files, DB_NAME, and _DUMP_DEST folders. .. 4 .- Define the new ORACLE_SID
5 .- Create the new service.
6 .- Creation
password file (if the pfile is REMOTE_LOGIN_PASSWORDFILE = exclusive) 7 .- sqlplus as SYSDBA connection
8 .- Startup the instance and creating the SPFILE parameter file Backup
9 .- the controlfile to trace the original DB
10 .- Recreation controlfile to clause
SET NAME. 11 .- Open the database with OPEN RESETLOGS mode

.




1 .- Cold Backup of the original DB.
Restore backup on new location.
- Implement the outcome of the next sentence and script.
- NOTE: Beware of duplicate file names. ------------------------------------------------- ------------ select 'Immediate shutdown;' from dual union all

select 'host copy' 2 .- Generation pfile for the new database

SQL> create pfile = '? \\ Admin \\ sid \\ pfile \\ inittest.ora' from spfile;
file created.



3 .- Edit the pfile to replace: control_files, DB_NAME, and folders _DUMP_DEST ...





4 .- Define the new ORACLE_SID


c: \\> set ORACLE_SID = test




5 .- Create the new service.


c: \\> oradim-NEW-SRVC-StartMode OracleServicetest self


6 .- Creating the password file


c: \\> orapwd file = C: \\ orant \\ ora92 \\ database \\ PWDtest.ora password = xxxxxxxxx


7 .- sqlplus as SYSDBA connection


C: \\> sqlplus SQL * Plus: Release 9.2.0.6.0 - Production on Fri July 29 16:41:22 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter the user name: sys / xxxxxxxxxx
as sysdba Connected to an idle instance.


8 .- Startup the instance and file creation parameters


SPFILE SQL> STARTUP PFILE NOMOUNT = 'C: \\ DIRECTORIO_DESTINO \\ inittest.ora'
ORACLE Instance initiated. Total System Global Area 1074866044 bytes Fixed Size 456572 bytes

Variable Size 905969664 bytes Database Buffers 167772160 bytes

Redo Buffers 667648 bytes
SQL> create spfile from pfile = 'C: \\ DIRECTORIO_DESTINO \\ inittest.ora';
File created.



9 .- PROD backup of controlfile to trace.


SQL> alter database backup controlfile to trace;

Database altered.



10 .- From the trace control file. Recreation
controlfile with SET NAME to the new name.


CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS
NOARCHIVELOG REUSE
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXDATAFILES
MaxInstance 1 133 453
MAXLOGHISTORY

LOGFILE GROUP 2 'C: \\ DATA \\ TEST \\ REDO \\ REDO02.LOG' SIZE 100M ,
GROUP 3 'C: \\ DATA \\ TEST \\ REDO \\ REDO03.LOG' SIZE 100M, GROUP 4
'C: \\ DATA \\ TEST \\ REDO \\ REDO04.LOG' SIZE 150M, GROUP 5
'C: \\ DATA \\ TEST \\ REDO \\ REDO05.LOG 'SIZE 150M, GROUP 6
' C: \\ DATA \\ TEST \\ REDO \\ REDO06.LOG ' SIZE 200M - STANDBY LOGFILE DATAFILE

(... files ...)

'C: \\ DATA \\ TEST \\ SYSTEM \\ SYSTEM01.DBF'
'C: \\ DATA \\ TEST \\ DATA \\ DATA01.DBF' CHARACTER SET WE8MSWIN1252

;
Control file created.


11 .- Open the database with OPEN RESETLOGS mode.

SQL> alter database open RESETLOGS;

Database altered.




12 .- Verification.


SQL> select instance_name from v $ instance;
INSTANCE_NAME
----------------

test SQL> select name from v $ database;


NAME --------- TEST


SQL> select status from v $ thread;

OPEN STATUS ------




12 .- Shutdown and Open database.


SQL> shutdown Immediate; Database closed. Database removed. ORACLE Instance
closed.

SQL> startup ORACLE instance started
.

Total System Global Area 1074866044 bytes Fixed Size 456572 bytes

Variable Size 905969664 bytes Database Buffers 167772160 bytes

Redo Buffers
667648 bytes Database mounted.
open database.



Where To Find Red Velvet Cake In Toronto Area









On occasion I needed to recover a transaction COMMIT validated, but unwanted or erroneous. Here's an example:
- user deletes a row.
- by accident.
- Do not know what line it is, but 'something' says "deleted record."
-
(... deleted and validated)
.
- No idea what was the row data.
- Neither he, nor anyone.
- Since then, the row X has disappeared without trace.

With variations, this case is quite frequent, and if the user has erased the record is fast enough, there is a possibility of recovering the lost data.

Generally, all conventional transaction information processed through the areas of redo log. In these files is all the information for the new change. Oracle bases its entire business in the proper functioning of the redo log record and, therefore, in this area only basic physical data stores to redo the operation. Therefore, no information is stored on the previous values.

Which it does in the area of \u200b\u200brollback and rollback management also happens to redo!.
Oracle has a package, the LOG MINER that tracks the redo logs (online and archived) along with the rollback information also available in them. Once you run the package that creates the object dictionary file, Oracle is able to interpret and display information such redologs as valid as the generated SQL and SQL opposite to "repair" action.






SQL> connect / as sysdba Connected
.
SQL> show parameters utl NAME TYPE VALUE


------------------------------------ ------------------------------ -----------

utl_file_dir string c: \\ oraclefiles


SQL> exec
DBMS_LOGMNR_D.BUILD (DICTIONARY_FILENAME => 'dictionary.ora' DICTIONARY_LOCATION => 'c: \\ oraclefiles');
PL / SQL procedure successfully completed.
SQL> select member from v $ logfile;
----------------------------------- MEMBER --------------------------------------------- C: \\ ORACLE \\ oradata \\ ORCL \\ REDO04A.LOG C: \\ ORACLE \\ oradata \\ ORCL \\ REDO04B.LOG C: \\ ORACLE \\ oradata \\ ORCL \\ REDO05A.LOG C: \\ ORACLE \\ oradata \\ ORCL \\ REDO05B.LOG C: \\ ORACLE \\ oradata \\ ORCL \\ REDO06A.LOG
C: \\ ORACLE \\ oradata \\ ORCL \\ REDO06B.LOG
6 rows selected.

SQL> exec
DBMS_LOGMNR.add_logfile ('C: \\ ORACLE \\ oradata \\ ORCL \\ REDO04A.LOG');


PL / SQL procedure successfully completed.
SQL> exec
DBMS_LOGMNR.add_logfile ('C: \\ ORACLE \\ oradata \\ ORCL \\ REDO05A.LOG');

PL / SQL procedure successfully completed.
SQL> exec
DBMS_LOGMNR.add_logfile ('C: \\ ORACLE \\ oradata \\ ORCL \\ REDO06A.LOG');


PL / SQL procedure successfully completed.

SQL> EXECUTE
DBMS_LOGMNR.START_LOGMNR (DICTFILENAME => 'c: \\ oraclefiles \\ dictionary.ora');


PL / SQL procedure successfully completed.

SQL> set pages 100
SQL> set lines 120
SQL> column sql_redo
format a50 SQL> column sql_undo
format a50 SQL> select sql_redo, sql_undo from v $ logmnr_contents
WHERE rownum


SQL_REDO SQL_UNDO -------------------------------------------------- --------------------------------------------------
insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX", "Amount MIN" Amount SUM "= '170, 01 ' and "Amount COUNT" = '1 '
, "Amount AVG", "City", "Country", "Age Range", "Sex" and "Amount MAX' = '170, 01 'and' Amount MIN" = '
, "Flight Details") values \u200b\u200b('170, 01 ', '1', '170, 01 ', '1 170.01' and 'Amount AVG = '170, 01' and 'City' 70.01 ', '170, 01', 'Madeira', 'Portugal', 'Over 5 =' Madeira 'and "Country" =' Portugal 'and' Eda Range 0 to ± os', 'Woman', 'VUELO52149' ) d '=' Over 50 a ± os 'and' Sex '=' Male 'and
"Flight Details" =' VUELO52149 'and ROWID =' AAALV
mAAPAAAAn8AAA ';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where " and SUM", "Amount COUNT", "Amount MAX", "Amount MIN" Amount SUM " = '112, 95 'and' Amount COUNT "= '1 '," Amount AVG "," City "," Country "," Age Range "," Sex "and" Amount MAX' = '112, 95 'and "Amount MIN" = '
, "Flight Details") values \u200b\u200b('112, 95', '1 ', '112, 95', '1 112.95 'and' Amount AVG = '112, 95 'and " City "
12.95 ', '112, 95', 'Madeira', 'Portugal', 'Over 5 =' Madeira 'and" Country " = 'Portugal' and 'Eda
Range 0 to ± os',' Woman ',' VUELO52206 ') d' = 'Over 50 a ± os' and' Sex '=' Male 'and
"Flight Details" = 'VUELO52206' and ROWID = 'AAALV
mAAPAAAAn8AAB';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX "," Amount MIN "Amount SUM" = '123, 29 'and' Amount COUNT "= '1 '
," Amount AVG "," City "," Country "," Age Range "," Sex "and" Amount MAX = '123, 29 'and' Amount MIN "= '," Flight Details ") values \u200b\u200b('123, 29', '1 ', '123, 29', '1 123.29 'and' Amount AVG" = ' 123.29 "and" City " 23.29 ', '123, 29', 'Madeira', 'Portugal', 'Over 5 =' Madeira 'and" Country "=' Portugal 'and' Range Eda <10;
0 a ± os', 'Woman', 'VUELO52331') d '=' Over 50 a ± os' and 'Sex' = 'Male' and
"Flight Details" = 'VUELO52331' and ROWID = 'AAALV mAAPAAAAn8AAC ';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from "DISCOVERER9I." EUL5_MV101651 "where"
and SUM "," Amount COUNT "," Amount MAX "," Amount MIN "Amount SUM" = '178, 55 'and' Amount COUNT "= '1 '
, "Amount AVG", "City", "Country", "Age Range", "Sex" and "Amount MAX = '178, 55 'and' Amount MIN" = '
, "Flight Details") values \u200b\u200b('178 , 55 ', '1', '178, 55 ', '1 178.55' and 'Amount AVG = '178, 55' and 'City'
78.55 ', '178, 55', 'Madeira' , 'Portugal', 'Over 5 =' Madeira 'and "Country" =' Portugal 'and' Eda
Range 0 to ± os', 'Woman', 'VUELO52419') d '=' Over 50 to ± os' and "Sex" = 'Male' and
"Flight Details" = 'VUELO52419' and ROWID = 'AAALV
mAAPAAAAn8AAD';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX", "Amount MIN" Amount SUM "= '107, 36 'and' Amount COUNT" = '1 '
, "Amount AVG", "City" "Country", "Age Range", "Sex" and "Amount MAX = '107, 36 'and' Amount MIN" = '
, "Flight Details") values \u200b\u200b('107, 36', '1 ',' 107.36 ', '1 107.36' and 'Amount AVG = '107, 36 'and' City '
07.36', '107, 36 ',' Madeira ',' Portugal ',' Over 5 = 'Madeira' and "Country" = 'Portugal' and " Eda
Range 0 to ± os ',' Woman ',' VUELO52488 ') d' = 'Over 50 a ± os' and 'Sex' = 'Male' and
"Flight Details" = 'VUELO52488' and ROWID = 'AAALV
mAAPAAAAn8AAE';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX", "Amount MIN" Amount SUM "= '120, 5 ' and "Amount COUNT" = '1 'to
, "Amount AVG", "City", "Country", "Age Range", "Sex" nd "Max Amount" = '120, 5 "and" Amount MIN =
'12, "Flight Details") values \u200b\u200b('120, 5 ', '1', '120, 5 ', '120 0.5' and 'Amount AVG = '120, 5' and 'City' = ' M
, 5 ', '120, 5', 'Madeira', 'Portugal', 'Over 50 to ± adeira "and" Country "=' Portugal 'and' Range Age" =
os', 'Woman' 'VUELO52561'), 'Over 50 a ± os' and "Sex" = "Woman" and "Flight Of
size" =' VUELO52561 'and ROWID =' AAALVmAAP
AAAAn8AAF ';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX", "Amount MIN" Amount SUM " = '109, 01 'and' Amount COUNT "= '1 '
," Amount AVG "," City "," Country "," Age Range "," Sex "and" Amount MAX' = '109, 01 'and "Amount MIN" = '
, "Flight Details") values \u200b\u200b('109, 01', '1 ', '109, 01', '1 109.01 'and' Amount AVG = '109, 01 'and " City "
09.01 ', '109, 01', 'Madeira', 'Portugal', 'Over 5 =' Madeira 'and" Country " = 'Portugal' and 'Eda
Range 0 to ± os',' Woman ',' VUELO52690 ') d' = 'Over 50 a ± os' and' Sex '=' Male 'and
"Flight Details" = 'VUELO52690' and ROWID = 'AAALV
mAAPAAAAn8AAG';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from" DISCOVERER9I. "EUL5_MV101651" where "
and SUM", "Amount COUNT", "Amount MAX "," Amount MIN "Amount SUM" = '174, 91 'and' Amount COUNT "= '1 '
," Amount AVG "," City "," Country "," Age Range "," Sex "and" Amount MAX = '174, 91 'and' Amount MIN "= '
," Flight Details ") values \u200b\u200b('174, 91', '1 ', '174, 91', '1 174.91 'and' Amount AVG" = ' 174.91 "and" City "
74.91 ', '174, 91', 'Madeira', 'Portugal', 'Over 5 =' Madeira 'and" Country "=' Portugal 'and' Range Eda
0 a ± os', 'Woman', 'VUELO52693') d '=' Over 50 a ± os' and 'Sex' = 'Male' and
"Flight Details" = 'VUELO52693' and ROWID = 'AAALV
mAAPAAAAn8AAH ';

insert into "DISCOVERER9I." EUL5_MV101651 ("Import delete from "DISCOVERER9I." EUL5_MV101651 "where"
and SUM "," Amount COUNT "," Amount MAX "," Amount MIN "Amount SUM" = '131, 5 "and" Amount COUNT "= '1 'to
"Amount AVG", "City", "Country", "Age Range", "Sex" nd "Amount MAX = '131, 5" and "Amount MIN" = '13
, "Flight Details") values \u200b\u200b( '131, 5 ', '1', '131, 5 ', '131 1.5' and 'Amount AVG = '131, 5' and 'City' = 'M
, 5', '131, 5 ' 'Madeira', 'Portugal', 'Over 50 to ± adeira "and" Country "=' Portugal 'and' Range Age" =
os ',' Woman ',' VUELO52951 '),' Over 50 to ± os' and "Sex" = "Woman" and "Flight Of
size" = 'VUELO52951' and ROWID = 'AAALVmAAP
AAAAn8AAI';


9 rows selected.










World List Breast Size By Nationality

Using Access to MSAccess DB from Oracle.


You can access oracle databases are not seamlessly with Oracle Transparent Gateways

.

This feature allows you to configure an ODBC DSN entry as you would any Oracle service. Thus, through a dblink, a user could access a table in a database access (or SQLServer or MySQL, for example) from a query or from PL / SQL.

heterogeneous services architecture is based on the following configuration:

You specify a TNS entry in tnsnames.ora file

resolve a host connection, port and service name specified with the parameter
HS = OK
(Oracle Heterogeneous Services).

On the other hand, the target listener is defined for that service call to a program called "hsodbc" which, through a parameter file init

. Ora enter the DNS associated with specific MSAccess database. In this way, and creating a dblink, anyone could make a select data to cross the Oracle schema and an Access DB. STEPS 1 .- Install the dictionary heterogeneous services.
2 .- Configure the tnsnames.ora


3 .- Configure the listener.


4 .- Check that the listener and the tnsnames.ora work properly. 5 .- Configure ODBC for DB access.

6 .- Create dblink to the DB access. 7 .- Create the init file


. Ora

8 .- Run a query using this dblink.


1 .- Install in the dictionary heterogeneous services
@? / rdbms / admin / caths.sql

NOTE: these views may be installed already in the database.
2 .- Configure the tnsnames.ora bbdd_access =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = tcp)
(HOST =
192,168 .2.4

)


(PORT = 1521)
)
(CONNECT_DATA =
(SERVICE_NAME = odbc_access) ) (HS = OK)
)
3 .- Configure the listener. (Entry in bold is to be added) ...
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC0))

)

(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
192.168.2.4
)(PORT = 1521))
)
)
)
SID_LIST_LISTENER = (SID_LIST =
(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = D:\oracle\ora92)

(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = D:\oracle\ora92)
(SID_NAME = orcl)
)
(SID_DESC =
(ORACLE_HOME = D:\oracle\ora92)
(SID_NAME = odbc_access)
(PROGRAM = hsodbc)
)
)
4 .- Check that the listener and the tnsnames.ora is working properly.
C: \\ Documents and Settings \\ Administrator> tnsping bbdd_access

TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 08-SEP-2006 18:19: 42

Copyright (c) 1997 Oracle Corporation. All rights reserved.
parßmetros Files used:

D: \\ oracle \\ ora92 \\ network \\ admin
\\ sqlnet.ora

TNSNAMES Adapter used to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)


(HOST = 192.168. 2.4)
(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = odbc_access)) (HS
= OK))
Properly performed (50 ms)


5 .- Configuring ODBC for the DB access.
access the database used in the example has a single table with four rows of example ... create table example (id counter, text value)



need to create an ODBC to access specific access to the database. Since this option is set to Windows Control Panel, Administrative Tools, ODBC Manager and the System DSN tab.

from there establishing odbc_access driver connected to the database you use: "test_hs.mdb" with this example table.



NOTE: This access is password bbdd "tesths"
6 .- Create dblink to the DB access. SQL> CREATE DATABASE LINK bbdd_access
2 CONNECT TO ADMIN TESTHS
3 IDENTIFIED BY USING 'bbdd_access';
Link to the database created.
7 .- Create the init file
. Ora in the directory ORACLE_HOME / hs / admin /


- FILE initODBC_ACCESS.ora
#




# HS init parameters


# HS_FDS_CONNECT_INFO = odbc_access
HS_FDS_TRACE_LEVEL = 0

HS_FDS_TRACE_FILE_NAME = odbc_access.trc

HS_AUTOREGISTER = TRUE



8 .- Launch the query via the dblink
SQL> column "value" format a40
SQL> set pages 1000
SQL> set Lines 120

SQL > select * from @ bbdd_access example,

id
value
---------- ---------------------- -------- ----------
1 data1
2 data2
3 data3

4 dato4


Book About Weight Watcher

SQL Query Optimization in Oracle Oracle

The following query takes 11 hours to run.
SELECT DISTINCT A.
NODO_ID, B. NODO_B_ID NODO_EQ1 BITOWN03.BS_R_NODOS_BIT_03 FROM A BITOWN03.RE_R_CONEX_EXTERNAS_BIT_03 B, C
BITOWN03.TMP_NODOS_OK_EST_BIT_03
NODO_ID = B WHERE A. AND B. NODO_A_ID NODO_B_ID = C. NODO_ID;
the following implementation plan SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls PLAN_TABLE_OUTPUT --------------------------------------- ---------------------------------------------- ------------------------------------------------- ---------------------------------- Predicate Information (identified by Operation id): ---- -----------------------------------------------
7 - access ("B". "NODO_B_ID" = "C". "NODO_ID" AND "A". "NODO_ID" = "B". "NODO_A_ID)
Note: CPU Costing is off




** ************************************************** ****************************
SOLUTION to the case.

************************************************ ******************************** Another
Cartesian product. In this case the Cartesian knows what he does. Cross almost 6,000 million rows (a total of 61 gigabytes of data) and at minimal cost. What a paradox.
A detail to understand this decision: there are no restrictions on Primary Key or Foreign Key
or unique indexes, constraints or Not Null.

Because of this, Oracle is practical to combine all the results of a table (4.5 million) over the 1400 rows in another table, a
"everyone with everyone"
.



Not bad. However, no information to Oracle, much to analyze the tables, it will not be able to get

priori. We are interested only unique values \u200b\u200bin the relationship table, which exist in their related tables, but as I say, there is nothing to provide that information to Oracle.

change some details of the consultation and leave it like that:








SELECT DISTINCT A.

NODO_ID, B. NODO_B_ID NODO_EQ1
FROM BITOWN03.BS_R_NODOS_BIT_03 A,
(select distinct nodo_a_id, nodo_b_id from BITOWN03 . RE_R_CONEX_EXTERNAS_BIT_03) B, C
BITOWN03.TMP_NODOS_OK_EST_BIT_03
NODO_ID = B WHERE A. AND B. NODO_A_ID
NODO_B_ID = C. NODO_ID;


Report of two things: that I have interest in obtaining the separate codes in the relationship table, and also exist in the other two tables.

The implementation plan to run completely changed as I have said otherwise

. Now Oracle does this other implementation plan.

SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls
PLAN_TABLE_OUTPUT -------------------------- --------------------------------------------------
----------------- ------------------------------- --------------------------------------------------
------------ 81M
13626 cost units. Regarding the previous cost of only 23. But now appears the Cartesian and it seems that the implementation is more faithful to what we want. I have just released
implementation:
one minute and twenty seconds. Well
.

What's The Strongest Underwear

Tips: Change character set parameter in the database

1. Check NLS_CHARACTERSET


Connect to SYS or SYSTEM user




SELECT * FROM V $ NLS_PARAMETERS


WHERE PARAMETER = 'NLS_CHARACTERSET';
Parameter Value

NLS_CHARACTERSET AL32UTF8





If you want to change NLS_CHARACTERSET from AL32UTF8 to TH8TISASCII



2. Connect to user SYS



3. Update value





UPDATE PROPS$


SET VALUE$ = 'TH8TISASCII'


WHERE NAME = 'NLS_CHARACTERSET';


COMMIT;

4. Restart database

STARTUP;

5. Check NLS_CHARACTERSET
Connect to user SYS or SYSTEM
SELECT * FROM

V$NLS_PARAMETERS
WHERE PARAMETER = 'NLS_CHARACTERSET';
Parameter Value
NLS_CHARACTERSET TH8TISASCII

Property Tax In Houston Area

SQL Query Optimization in Oracle

The following query
was canceled after 15 hours and 37 minutes
execution.
SQL> select count (*) from (SELECT BITOWN03.BS_C_CLIENTES_BIT_03.DNICIF_DE, BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.CONTRATO_ID 2, 3 HSCONTRATOS_ESTADOS.ESTADO_DE
, BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.FEC_ESTADO_DT 4, 5 BITOWN03.BS_C_CLIENTES_BIT_03.ABONADO_ID
6 FROM BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03 7, 8 BITOWN03.LK_C_ESTADOS_BIT_03 HSCONTRATOS_ESTADOS,
BITOWN03.BS_C_CLIENTES_BIT_03 9, 10 BITOWN03.BS_C_CONTRATOS_BIT_03 CONTRACT = 11 WHERE BITOWN03.BS_C_CLIENTES_BIT_03.ABONADO_ID CONTRATOS.ABONADO_ID
BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.CONTRATO_ID = 12 AND 13 AND CONTRATOS.CONTRATO_ID
BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.ESTADO_ID HSCONTRATOS_ESTADOS.ESTADO_ID = 14 BETWEEN 15 AND BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.FEC_ESTADO_DT to_date ('01-06-2005 00:00:00 ',' DD-MM-YYYY HH24: MI: SS ') AND 16
to_date ('30-23 06-2005: 59:59 ',' DD-MM-YYYY HH24: MI: SS ') AND 17 BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03.ESTADO_ID =' BA '); BITOWN03.HS_C_ESTADOS_CONTRATO_BIT_03,
* ERROR at line 7: ORA-00028: your session has Been Killed

Elapsed: 15:37:01.66

the following implementation plan

SQL> @ C: \\ ORACLE \\ ORA92 \\ RDBMS \\ ADMIN \\ UTLXPLS
PLAN_TABLE_OUTPUT -------------------------------------- --------------------------------------------------
-------------------------------- ---------------- -------------------------------------------------- -------------------------------------------------- -

Predicate Information (identified by Operation id): --------------------------------------
------------- 5 - access ("HSCONTRATOS_ESTADOS. ESTADO_ID" = 'BA') 6 - access ("HS_C_ESTADOS_CONTRATO_BIT_03. FEC_ESTADO_DT> = TO_DATE ('2005- 06-01 00:00:00 ',' yyyy-mm-dd HH24: mi: ss') AND "HS_C_ESTADOS_CONTRATO_BIT_03. ESTADO_ID" = 'BA' AND
"HS_C_ESTADOS_CONTRATO_BIT_03. FEC_ESTADO_DT"
filter ("HS_C_ESTADOS_CONTRATO_BIT_03 . ESTADO_ID "=" HSCONTRATOS_ESTADOS. ESTADO_ID "AND " HS_C_ESTADOS_CONTRATO_BIT_03. ESTADO_ID "= 'BA') 9 - filter (" BS_C_CLIENTES_BIT_03. ABONADO_ID "=" contracts "." ABONADO_ID)
10 - access ("HS_C_ESTADOS_CONTRATO_BIT_03." CONTRATO_ID "=" Contracts. "CONTRATO_ID) Note: cpu costing is off **************** ************************************************** SOLUTION **************
the case. ************************************************ ********************************



The tables contain statistics faithful. The Cartesian product not deceived: cross 58 GB to meet our request. Anyway, something is wrong. That plan is not optimal.

statistics generated by the next call to DBMS_STATS

.


SQL> begin 2 DBMS_STATS.GATHER_TABLE_STATS
(OWNNAME => user,
3 TABNAME => table,
4 ESTIMATE_PERCENT => dbms_stats.auto_sample_size,
5 METHOD_OPT => 'FOR ALL INDEXED COLUMNS SIZE 1', 6 DEGREE
=> 4);
7 end;
8 /

PL / SQL procedure successfully completed.



must not only analyze the tables, but also the indices. Some of them are analyzed using the procedure
DBMS_STATS.GATHER_INDEX_STATS
, but one of the tables is partitioned. The best and simplest is to include the parameter
CASCADE => TRUE
in the call to DBMS_STATS .
is true that the cost of increased analysis of these tables. In addition, the CASCADE parameter affects not only rates but also materialized views, partitions, etc.. (Ie, all its dependencies).

With tables analyzed in this way, the new implementation plan is this:









SQL> @c:\oracle\ora92\rdbms\admin\utlxpls

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------
BY INDEX ROWID 00:00:00 ',
' yyyy-mm-dd HH24: mi: ss ') AND "HS_C_ESTADOS_CONTRATO_BIT_03." ESTADO_ID "=' BA 'AND
" HS_C_ESTADOS_CONTRATO_BIT_03. "FEC_ESTADO_DT"
HH24: mi: ss') )
filter ("HS_C_ESTADOS_CONTRATO_BIT_03." ESTADO_ID "= 'BA')
6 - access (" HSCONTRATOS_ESTADOS. "ESTADO_ID" = 'BA')
9 - access ("BS_C_CLIENTES_BIT_03." ABONADO_ID "=" Contracts. " "ABONADO_ID)

Note: cpu costing is off 30 rows selected
<=TO_DATE('2005-06-30 23:59:59', 'yyyy-mm-dd hh24:mi:ss'))
.





The execution now takes only:
3 seconds.

The cost of testing increases of 26 minutes 32 minutes. The gain justifies the cost.

Okay. :-)


# posted by Javier Morales @ 6:13 PM 0 comments








Monday, October 17, 2005



NOT IN vs. NOT EXISTS.



to Fernando, which awaits. :-P The following query was canceled after 5 hours and 11 minutes
run.



SELECT count (CLI.COD_ABONADO)
BITOWN02.TM_C_CLIENTES_SAC_02 FROM CLI,
BITOWN02.TE_ERRORES_BIT_02 WHERE YOU
TE.FILA_ID CLI.ROWID = (+)
AND 'TM_C_CLIENTES_SAC_02' = TE.TABLA_DE (+) TE.ERROR_ID IS NULL AND CLI.COD_ABONADO AND NOT IN (SELECT
FROM CU.ABONADO_id BITOWN03.BS_C_CONTRATOS_BIT_03 CONT, CU BITOWN03.BS_C_CUENTAS_BIT_03 WHERE CU.CUENTA_ID = CONT.CUENTA_ID
)




the following implementation plan


SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls


PLAN_TABLE_OUTPUT ------------------------------------------------

----------- ------------------------------------- -------------------------------------------------- --------------------------------------------
HASH JOIN OUTER ACCESS BY INDEX ROWID
: B1)))
3 - filter ("TE_M_ERRORES_BIT_01. ERROR_ID" IS NULL)
4 - access ("SYS_ALIAS_1." ROWID = "TE_M_ERRORES_BIT_01. FILA_ID "(+))
10 - filter (LNNVL ( "CU." ABONADO_ID "
: B1))
11 - access (" CU "." CUENTA_ID "=" account "." CUENTA_ID)

Note: CPU Costing is off 30 rows selected

.

<=TO_DATE('2005-06-30 23:59:59', 'yyyy-mm-dd

********************************************** **********************************

SOLUTION to the case.

************************************************ ********************************


In this case, consultation with IN has an acceptable cost. However, after five hours of execution, one suspects that things are not going well. The implementation strategy is to make two FILTER: one for the Client OuterJoin without errors and the second to combine (in a very heavy NestedLoops) with contract accounts.
As the subquery is becoming even heavier than the main can be replaced by
IN

EXISTS clause is
a good strategy.

Yes, I have also been careful not null codes to answer the inquiry, as NOT IN and NOT EXISTS

Explain plan for SELECT count (CLI.COD_ABONADO)

BITOWN02.TM_C_CLIENTES_SAC_02 FROM CLI, BITOWN02.TE_ERRORES_BIT_02 WHERE YOU CLI.ROWID = TE.FILA_ID (+)

AND 'TM_C_CLIENTES_SAC_02' = TE.TABLA_DE (+)

TE.ERROR_ID IS NULL AND
AND NOT EXISTS (SELECT null BITOWN03.BS_C_CONTRATOS_BIT_03 CONT FROM, WHERE BITOWN03.BS_C_CUENTAS_BIT_03 CU CLI.COD_ABONADO = CU.ABONADO_ID AND CU.CUENTA_ID = CONT.CUENTA_ID)


The resulting execution plan appears to be similar to the above, including the cost seems worse.



SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls

PLAN_TABLE_OUTPUT
------------------------- --------------------------------------------------

------- ----------------------------------------- -------------------------------------------------- --------------------------------------------------
---------
11
11 - access ("CU". "CUENTA_ID" = "CONT." CUENTA_ID)
Note: cpu costing is off



I launch the performance:
28 seconds.

Très bien. :-)





# posted by Javier Morales @ 6:12 PM 0 comments










Thursday, October 13, 2005



Say it otherwise.


<>
To Manel Moreno, who has given me no kiss for that.
: P
<>


The following query takes 11 hours to run.


SELECT DISTINCT A.

NODO_ID, B. NODO_B_ID NODO_EQ1
FROM BITOWN03.BS_R_NODOS_BIT_03 A,
BITOWN03.RE_R_CONEX_EXTERNAS_BIT_03 B, C BITOWN03.TMP_NODOS_OK_EST_BIT_03 NODO_ID = B WHERE A. AND B. NODO_A_ID
NODO_B_ID = C. NODO_ID;



the following implementation plan SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls PLAN_TABLE_OUTPUT
------------- --------------------------------------------------
---------------------- -------------------------- -------------------------------------------------- ------- solution to the case. ************************************************ ********************************


Another Cartesian product. In this case the Cartesian knows what he does. Cross almost 6,000 million rows (a total of 61 gigabytes of data) and at minimal cost. What a paradox.

A detail to understand this decision: there are no restrictions on Primary Key or Foreign Key
or unique indexes, constraints or Not Null. Because of this, Oracle is practical to combine all results in a table (4.5 million) over the 1400 rows in another table, a
"everyone with everyone" .


Not bad. However, no information to Oracle, much to analyze the tables, it will not be able to obtain a priori

. We are interested only unique values \u200b\u200bin the relationship table, which exist in their related tables, but as I say, there is nothing to provide that information to Oracle.

change some details of the consultation and leave it like that:






SELECT DISTINCT A.

NODO_ID, B. NODO_B_ID NODO_EQ1
FROM BITOWN03.BS_R_NODOS_BIT_03 A,
(select distinct nodo_a_id, nodo_b_id from BITOWN03.RE_R_CONEX_EXTERNAS_BIT_03) B, C
BITOWN03.TMP_NODOS_OK_EST_BIT_03 NODO_ID = B WHERE A. AND B. NODO_A_ID
NODO_B_ID = C. NODO_ID;





report of two things : that I have interest in obtaining the separate codes in the relationship table, and also exist in the other two tables.

The implementation plan to run completely changed as I have said otherwise

. Now Oracle does this other implementation plan.




SQL> @ c: \\ oracle \\ ora92 \\ rdbms \\ admin \\ utlxpls

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------
VIEW

6 - access ("B". "NODO_B_ID" = "C". "NODO_ID)
7 - access (" A "." NODO_ID "=" B "." NODO_A_ID)







The cost now seems completely shot. 13626

cost units. Regarding the previous cost of only 23. But now appears the Cartesian and it seems that the implementation is more faithful to what we want. I have just released
implementation:
one minute and twenty seconds. Well
.
# posted by Javier Morales @ 6:11 PM 0 comments

Poor Cardinality

For Cristina Alvarez, who trusted me from day one and hid it with all his soul.

:)
The following query was canceled after one hour and twenty minutes of execution.


SELECT N2.ENTIDAD_ID, CLI.rowid Row_A, cli .*,
MAX (REL.ABONADO_PADRE_ID) OVER (PARTITION BY ABONADO_HIJO_ID) REL_ABONADO_PADRE_ID BITOWN03.BS_V_MGEC_NODO_BIT_03 FROM N1, N2 BITOWN03.BS_V_MGEC_NODO_BIT_03 ,
BITOWN03. BS_V_MGEC_REL_NODOS_BIT_03 RN,
BITOWN02.TM_C_CLIENTES_SAC_02 CLI, REL BITOWN03.RE_C_RELACIONES_ABONADO_BIT_03

N1.ENTIDAD_ID = CLI.COD_DNICIF
WHERE AND AND N1.NODO_ID = RN.NODO_ID
RN.FECHA_FIN_DT RN.TIPO_RELACION_ID = 2 AND IS NULL AND RN.NODO_PADRE_ID
AND CLI = N2.NODO_ID
. COD_ABONADO = REL.ABONADO_HIJO_ID (+);



the following implementation plan



PLAN_TABLE_OUTPUT
-------------------- --------------------------------------------------

----------------------------- ------------------- --------------------------------------------------
------------------------------ Rows 1
filter ("CLI". "COD_ABONADO" = "REL." ABONADO_HIJO_ID "(+))
11 - filter ("N1". "ENTIDAD_ID" = "CLI". "COD_DNICIF)
12 - access (" N1 "." NODO_ID "=" RN "." NODO_ID)
14 - access ("RN". "NODO_PADRE_ID" = "N2". "NODO_ID)





********* ************************************************** *********************

solution to the case.

************************************************ ********************************

Omitting the detail that the clause distinct enough. The plans maintain that resulting from similar performances.



seems quite acceptable plan. However, a Cartesian product attention ... "Only get a row? In this case, the Cartesian will not hurt. We will see the total of rows in the table if the table has generated statistics (column num_rows
of
user_t
can give us a clue) and if the filter operation 7 really solves a single row.






SQL> select count (*) from bitown03.BS_V_MGEC_REL_NODOS_BIT_03;
COUNT (*) ----------



118,907

SQL> select table_name, NUM_ROWS from dba_tables 2 WHERE table_name = 'BS_V_MGEC_REL_NODOS_BIT_03';


NUM_ROWS TABLE_NAME ------------------------------ ----------



BS_V_MGEC_REL_NODOS_BIT_03 118,907



SQL> select count (*) from bitown03.BS_V_MGEC_REL_NODOS_BIT_03

TIPO_RELACION_ID 2 where = 2 AND FECHA_FIN_DT IS NULL; -> FILTER OPERATING 7




COUNT (*) ----------









12844 Apparently not ... We're seeing a Cartesian product of 1.5 million rows (FULL TABLE SCAN operation 9) on 12,844 items. Oracle is bad estimating the cardinality of the rows. Cree for filter 7 only get one row and therefore does not trigger the Cartesian product cost. Fatty

error.

must correctly analyze the tables involved, indicating that they also analyze the values \u200b\u200bof the columns involved. The commands to perform this analysis are:



SQL> exec dbms_stats.gather_table_stats (OWNNAME => 'user', TABNAME => 'BS_V_MGEC_REL_NODOS_BIT_03' METHOD_OPT => 'for all columns');

PL / SQL procedure successfully completed.

Elapsed: 00:00:07.71
SQL> exec dbms_stats.gather_table_stats (OWNNAME => 'user', TABNAME => 'BS_V_MGEC_NODO_BIT_03' METHOD_OPT => 'for all columns');

PL / SQL procedure successfully completed.
Elapsed: 00:00:14.57



PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------

7 - filter ("RN". "TIPO_RELACION_ID" = 2 AND "RN". "FECHA_FIN_DT" IS NULL) 11 - access ("CLI". "COD_ABONADO" = "REL." "(+))

ABONADO_HIJO_ID filter ("CLI". "COD_ABONADO" = "REL." "(+))

ABONADO_HIJO_ID Note: cpu costing is off
Indeed, the plan's cost is higher, but REAL.

has taken only 23 seconds!

Thursday, January 8, 2009

Maltitol Syrup Recipes

TAG







































































SECOND REGIONAL

































THIRD REGIONAL







JUVENILE























































































































































Friday, January 2, 2009

Can Pregnant Women Use Ambosol For Toothaches




Some of the most difficult bugs we can find in a database is corrupted data blocks arise.

If we do get this error time will experience an increase in queries or receive ORA-01498 errors.

Oracle has several tools that help us identify and fix corrupted data that are occurring in a database:

a) ANALYZE TABLE table_name VALIDATE STRUCTURE.
b) DBVERIFY.
c) DB_BLOCK_CHECKING parameter.
d) DBMS_REPAIR


ANALYZE TABLE

This sentence is used to validate the structure of objects. If this statement returns an error means that there are bad blocks for that table.

sql>
MiSquema.Mitabla analyze table validate structure;

UTILITY DBVERIFY



is used to validate if there are bad blocks in a particular datafile. You need to tell by
pametro


blocksize block size that we set in the initialization parameter.

>
dbv blocksize = 8192 file = MiDatafile.dbf



DB_BLOCK_CHEKING




DB_BLOCK_CHEKING is an initialization parameter which forces or testing of the blocks each time a tablespace is to make a modification .


DBMS_REPAIR




This package allows to identify and fix the corrupt blocks in tables and indexes. This package is for a number of stored procedures:

CHECK_OBJECT: Detects if there are bad blocks on tables or indices.
FIX_CORRUPT_BLOCKS: Make those bad blocks.
DUMP_ORPHAN_KEYS: indicates those indices which were targeted by corrupt blocks. REBUILT_FREELISTS

SEGMENT_FIX_STATUS
SKIP_CORRUPT_BLOCKS: You must use to avoid the ORA-1578 would return after fixing a corrupt block.
ADMIN_TABLES:

We will simulate the identification and fixing of corrupt data within a table: sql >
connect / as sysdba sql

>
MiSquema.Mitabla analyze table validate structure;
OUTPUT: ORA-1498
examine the trace file to identify the file corrupt: OUTPUT ============= data_block_dump nrow = 5 create a table to store recovery information returned by this package. dbms_repair. Dbms_tables (table_name => 'REPAIR_TABLE'
table_type => dbms_reparir.repair_table,
action => dbms_repair.create_action, tablespace => 'USERS' )
Check for bad blocks in the table.

rpr_count int DECLARE, BEGIN dbms_repair. Check_object
(schema_name => 'MiSquema' object_name => 'mytable'
repair_table_name => 'REPAIR_TABLE' corrupt_count => rpr_count) END
rpr_count stored in the number of corrupt blocks found.
The following query displays information about the object involved in the corrupt block.
sql> select object_name
, BLOCK_ID, corrupt_type, marked_corrupt, from REPAIR_TABLE;

Before marking the block as unusable should be a backup of the table.
sql> create table MiTable_back as select * from mytable WHERE
dbms_rowid.rowid_block_number (rowid) = 5
and dbms_rowid.rowid_to_absolute_fno (rowid, 'MiSquema', 'MyTable') = 4
mark the box as unusable: fix_block_count int DECLARE, BEGIN
fix_block_count: = 0;
dbms_repair. fix_corrupt_blocks ( schema_name => 'MiSquema'
object_name => 'mytable', object_type => dbms_repair.table_object, repair_table_name => 'REPAIR_TABLE'
fix_count => fix_block_count) END;







Reference: http://mogukiller.wordpress.com/2008/12/26/reparar-bloques-corruptos/