create or replace procedure p ( p_str in varchar2 ) is l_str long := p_str; begin loop exit when l_str is null; dbms_output.put_line( substr( l_str, 1, 250 ) ); l_str := substr( l_str, 251 ); end loop; end; /
Показ дописів із міткою Oracle. Показати всі дописи
Показ дописів із міткою Oracle. Показати всі дописи
пʼятниця, 5 грудня 2014 р.
Oracle - convert clob into varchar2
https://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:367980988799
середа, 3 грудня 2014 р.
ubuntu - install toad for oracle
http://www.toadworld.com/products/toad-for-oracle/b/weblog/archive/2012/10/01/toad-11-6-runs-natively-on-linux.aspx
Here are the steps:
google: download toad for oracle free
2. Download the Oracle 11.2.0.1.0 client zip file (Note that 10g clients are no longer available)
Поправка: з часу написання статті шлях змінився
актуальний шлях:
wget -c http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_client.zip
а взагалі в гуглі: "install" Oracle 11.2.0.1.0 client
або в гуглі: Oracle Database 11g Release 2 for Microsoft Windows (32-bit)
3. Unzip the Oracle 11.2.0.1.0 client download into your user’s home directory (e.g. ~/client)
використовую наступну інструкцію:
http://makandracards.com/makandra/1258-install-the-verdana-and-tahoma-fonts-under-ubuntu-linux
Tahoma:
Here are the steps:
- Download Toad for Oracle 11.6 Commercial (32-bit) – choose the special, smaller MSI version (please note that the much larger downloads built on top of the “Quest Installer” not tested)
google: download toad for oracle free
2. Download the Oracle 11.2.0.1.0 client zip file (Note that 10g clients are no longer available)
Поправка: з часу написання статті шлях змінився
актуальний шлях:
wget -c http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_client.zip
а взагалі в гуглі: "install" Oracle 11.2.0.1.0 client
або в гуглі: Oracle Database 11g Release 2 for Microsoft Windows (32-bit)
3. Unzip the Oracle 11.2.0.1.0 client download into your user’s home directory (e.g. ~/client)
- Run command: wine --version and verify that you have at least version 1.4 (latest stable)
- If you need to update wine – here are the steps for Ubuntu (see Wine HQ for different Linux)
- Run command: sudo add-apt-repository ppa:ubuntu-wine/ppa
- Run command: sudo apt-get update
- Run command: sudo apt-get install wine
- Recheck your wine version – repeat steps a to c above until you see wine 1.4
- Run command ./winetricks gdiplus mdac28 msxml6 vb6run vcrun6sp6 tahoma msls31 riched20 riched30 richtx32 comctl32 comctl32.ocx
використовую наступну інструкцію:
http://makandracards.com/makandra/1258-install-the-verdana-and-tahoma-fonts-under-ubuntu-linux
Tahoma:
wget http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/EN-US/IELPKTH.CAB
cabextract -F 'tahoma*ttf' IELPKTH.CAB
mv -f tahoma*ttf /usr/share/fonts/truetype/msttcorefonts/
chmod 644 /usr/share/fonts/truetype/msttcorefonts/tahoma*
fc-cache -v
rm -f IELPKTH.CAB
- Run command: cd ~/client (or whatever directory you choseto unzip Oracle client to back in step #3)
- Run command: wine setup.exe (this will invoke the Oracle client installer program)
- Choose the third option: RUNTIME (754 MB) – see screen snapshot in Figure 2 below
- Select an Oracle home that you like and will remember – see screen snapshot in Figure 3 below
- Create a tnsnames.ora text file to point to your database(s) either manually or using Oracle netca
- Run command to copy your tnsnames.ora file to your Oracle client home selected in step 11 above: cp ~/tnsnames.ora ~/.wine/drive_c/oracle/product/10.2.0/client_1/NETWORK/ADMIN
- Run command: wine msiexec /i toad_for_oracle_11.6.msi (this runs the base Toad product installer)
- Run Toad either via desktop icon or menu Applications->wine->programs->Quest Software->Toad (Note – be patient first time Toad starts as it needs to copy some files from install to app directories)
понеділок, 24 листопада 2014 р.
Oracle - додати матеріалізовані в’юшки до групи оновлення
--створення групи оновлення
exec dbms_refresh.make('"RATER"."RATER_RG"',list=>null,next_date=>null,interval=>null,implicit_destroy=>FALSE,lax=>FALSE,rollback_seg=>NULL,push_deferred_rpc=>TRUE,refresh_after_errors=>FALSE,purge_option => 1,parallelism => 0,heap_size => 0);
--виведення переліку матеріалізованих в’юшок в схемі
select owner || '.' || name as t1 from all_snapshots where owner = 'RATER' order by name
--додавання в’юшки до групи
exec dbms_refresh.add(name=>'"RATER"."RATER_RG"',list=>'"RATER"."ACCESSORIALS"');
-- + не забуваємо про commit!
exec dbms_refresh.make('"RATER"."RATER_RG"',list=>null,next_date=>null,interval=>null,implicit_destroy=>FALSE,lax=>FALSE,rollback_seg=>NULL,push_deferred_rpc=>TRUE,refresh_after_errors=>FALSE,purge_option => 1,parallelism => 0,heap_size => 0);
--виведення переліку матеріалізованих в’юшок в схемі
select owner || '.' || name as t1 from all_snapshots where owner = 'RATER' order by name
--додавання в’юшки до групи
exec dbms_refresh.add(name=>'"RATER"."RATER_RG"',list=>'"RATER"."ACCESSORIALS"');
-- + не забуваємо про commit!
пʼятниця, 21 листопада 2014 р.
Oracle sql developer - code beautifier (format)
Oracle sql developer - так званий "code beautifier" в цій програмі називається просто "Format" і за замовчуванням викликається за допомогою комбінації клавіш Ctrl+F7. В Ubuntu дана комбінація є системною і тому можна викликати "Format" через контекстне меню (правою кнопкою мишки) або можна переналаштувати комбінацію клавіш через Tools -> Preferences -> Shortcut keys.
Oracle sql developer
Version 4.0.3.16
Oracle sql developer
Version 4.0.3.16
Oracle - приклад вибірки важких запитів (сортування за колонкою DISK_READS за спаданням)
Reports expensive SQL from V$SQLAREA, V$SQLTEXT view Joins to V$SQLTEXT using ADDRESS column
select sql_text
, lpad(username,9) parsing_user
, executions
, loads
, DISK_READS
, BUFFER_GETS
, ROWS_PROCESSED
from v$sqlarea a
, dba_users b
where upper(sql_text) not like upper('%dbms%')
and a.PARSING_USER_ID = b.user_id
--and DISK_READS > &number_of_expensive_DISK_READS
--and b.username = upper('&parsing_username')
order by DISK_READS desc
, ROWS_PROCESSED desc
, BUFFER_GETS desc
, username
/
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production PL/SQL Release 11.2.0.4.0 - Production "CORE 11.2.0.4.0 Production" TNS for Linux: Version 11.2.0.4.0 - Production NLSRTL Version 11.2.0.4.0 - Production
Oracle - приклад створення матеріалізованої в’юшки на базі попередньо створеної таблиці (prebuilt table)
CREATE MATERIALIZED VIEW "SCHEME"."SNAP_1"
ON PREBUILT TABLE WITHOUT REDUCED PRECISION
AS select
COLUMN1, COLUMN2
from TABLE;
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
ON PREBUILT TABLE WITHOUT REDUCED PRECISION
AS select
COLUMN1, COLUMN2
from TABLE;
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
вівторок, 2 вересня 2014 р.
пʼятниця, 22 серпня 2014 р.
Oracle - report sql monitor
SELECT DBMS_SQLTUNE.REPORT_SQL_MONITOR
( sql_id => 'a71hfjg8576s2',
session_id => 1234,
session_serial => 12,
report_level => 'all',
type => 'ACTIVE' )
FROM dual;
sql result -> blob -> html -> browser
( sql_id => 'a71hfjg8576s2',
session_id => 1234,
session_serial => 12,
report_level => 'all',
type => 'ACTIVE' )
FROM dual;
sql result -> blob -> html -> browser
Підписатися на:
Дописи (Atom)