How to list all my Oracle Products from Database park?

This is part of DBA role: know and prospect the use of Oracle Products for Oracle contract periodical review, isn’t?
It usually represent a huge problem, or, at least, demands a long time to refresh your spread sheet…

Well, If you use OEM, we offer you a better option! 😀
(I said ‘we’, because Dieison Santos came to me with this problem theese days…. So we talked about, I gave some directives and he mainly solved the problem. This way, great part of ‘we’ should be ‘he’… haha)

Without further, here’s a query that can map your environment (at least your Oracle database products):
You can use it to automate a report and set thresholds. Be creative… 😉

PS: From now, I’ll post all in english. Just for fun.

select
distinct(ddi.host_name) "Host",
(case
when opt.name like '%Active Data Guard%' then 'Oracle Active Data Guard'
when opt.name like '%Advanced Compression%' then 'Oracle Advanced Compression'
when opt.name like '%Audit Vault%' then 'Oracle Audit Vault'
when opt.name like '%Database Vault%' then 'Oracle Database Vault'
when opt.name like '%Partitioning (User)%' then 'Oracle Partitioning'
when opt.name like '%Real Application Clusters%' then 'Oracle Real Application Clusters'
when opt.name like '%Real Application Testing%' then 'Oracle Real Application Testing'
when (opt.name like '%ADDM%' or
opt.name like '%Automatic Database Diagnostic Monitor%' or
opt.name like '%Automatic Workload Repository%' or
opt.name like '%AWR%' or
opt.name like '%Baseline%' or
opt.name like '%Diagnostic Pack%' ) then 'Oracle Diagnostic Pack'
when (opt.name like '%SQL Monitoring%' or
opt.name like '%SQL Performance%' or
opt.name like '%SQL Performance%' or
opt.name like '%SQL Profile%' or
opt.name like '%SQL Tuning%' or
opt.name like '%SQL Access Advisor%' or
opt.name like '%Tuning Pack%') then 'Oracle Tuning Pack'
when opt.name like '%Change Management Pack%' then 'Oracle Change Management Pack'
when ddi.edition like 'Enterprise Edition' then 'Oracle Database Enterprise Edition'
else opt.name
end) "Produto Oracle",
hcd.num_cores "Cores",
ohs.virtual "Virtual",
hcd.impl "Processador",
ddi.dbversion "Versao"
from
mgmt$hw_cpu_details hcd,
mgmt$os_hw_summary ohs,
mgmt$db_dbninstanceinfo ddi,
(select
h.host_name as host,
h.target_name as database_name,
i.instance_name as instance_name,
h.target_type   as target_type,
h.target_guid as target_guid,
f.DBID,
f.NAME,
f.CURRENTLY_USED,
f.DETECTED_USAGES,
f.FIRST_USAGE_DATE,
f.LAST_USAGE_DATE,
f.VERSION,
f.LAST_SAMPLE_DATE,
f.LAST_SAMPLE_PERIOD,
f.TOTAL_SAMPLES,
f.AUX_COUNT,
f.DESCRIPTION
from
mgmt_db_featureusage f,
mgmt_targets h,
mgmt_db_dbninstanceinfo_ecm i,
gc$ecm_gen_snapshot s
where
s.is_current = 'Y' and
s.snapshot_guid = i.ecm_snapshot_id and
s.target_guid = f.target_guid and
h.target_type in ('oracle_database','rac_database') and
s.target_type = h.target_type and
s.snapshot_type in ('oracle_dbconfig','oracle_racconfig') and
f.DETECTED_USAGES>0
) opt
where
hcd.target_guid=ohs.target_guid
and ohs.host_name=ddi.host_name
and ddi.target_guid=opt.target_guid
and (    opt.name like '%Active Data Guard%' -- Active Data Guard
or opt.name like '%Advanced Compression%' -- Advanced Compression
or opt.name like '%Audit Vault%' -- Audit Vault
or opt.name like '%Database Vault%' -- DB Vault
or opt.name like '%Partitioning (user)%' -- Partitioning
or opt.name like '%Real Application Clusters%' --RAC
or opt.name like '%Real Application Testing%' -- RAT
or opt.name like '%ADDM%' -- Diagnostic Pack
or opt.name like '%Automatic Database Diagnostic Monitor%' -- Diagnostic Pack
or opt.name like '%Automatic Workload Repository%' -- Diagnostic Pack
or opt.name like '%AWR%' -- Diagnostic Pack
or opt.name like '%Baseline%' --  Diagnostic Pack
or opt.name like '%Diagnostic Pack%' -- Diagnostic Pack
or opt.name like '%SQL Monitoring%' -- Tuning Pack
or opt.name like '%SQL Performance%' -- Tuning Pack
or opt.name like '%SQL Profile%' -- Tuning Pack
or opt.name like '%SQL Tuning%' -- Tuning Pack
or opt.name like '%SQL Access%' -- Tuning Pack
or opt.name like '%Tuning Pack%' -- Tuning Pack
or opt.name like '%Change Management Pack%' -- Change Management Pack
or ddi.edition like 'Enterprise Edition')
order by ddi.host_name;

Matheus.

ORA-24777: use of non-migratable database link not allowed

Hoje reencontrei este erro e, como de costume, já havia esquecido qual era a solução. Por isso fica aqui minha anotação. 🙂
Tive que puxar mais da memória do que qualquer outra coisa, pois todos os links da primeira página do Google tinham apenas o stack do erro mas sem solução. Que na realidade é bem simples:

O erro ocorre devido sessão utilizando shared connection (XA) utilizar DBLink com conexão dedicated. O uso de XA no JDBC é uma configuração do datasource, caso você esteja utilizando weblogic, jboss, tomcat ou outro com suporte a java.
A solução que adotei até hoje consiste setar o “host” do DBLink ou a entrada de TNS utilizada pelo DBLink no arquivo tnsnames do BD de origem para utilizar tipo de conexão “shared” para conexão remota.

Ex Antes:  (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))) (CONNECT_DATA= (SERVICE_NAME=<serviço>) (SERVER=DEDICATED)))
Ex Depois:  (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))) (CONNECT_DATA= (SERVICE_NAME=<serviço>) (SERVER=SHARED)))

Segundo o stackoverflow, pode ser resolvido criando o database link como shared.
Ex: CREATE SHARED DATABASE LINK CONNECT TO bob IDENTIFIED  BY “MyNewPasswd1” AUTHENTICATED BY jim IDENTIFIED BY “JimsPass23” USING ‘DB01’;

Na realidade a segunda solução me pareceu muito mais elegante. Mas só percebi que existia depois de já ter resolvido pela primeira abordagem.
Se acontecer novamente, testo da segunda forma e comento aqui. Prometo. 😉

Ah!
Acho que não é necessario mencionar que o BD destino do DBLink precisa estar escutando em algum serviço com suporte a XA, né?
Não é o assunto deste post, então não vou entrar em detalhes. Mas basicamente você precisa setar para um valor diferente de zero os parâmetros: max_shared_servers; shared_servers; max_dispatchers e dispatchers e subir o serviço do dispartcher no listener. Taca no Google aí que essa parte é barbada!

Abraço!
Matheus.

Acentuação no SQLPLUS com Windows em inglês

Hoje perdi tempão pra fazer funcionar a acentuação no SQLPLUS com Windows em inglês. Resolvi compartilhar.
E não. Não basta escolher o idioma certo na instalação do client. Depende realmente do idioma do SO.

Cenário:
Server Windows com client Oracle 11.2 x64 instalado. Necessário usar esta versão do OracleClient visando reconhecimento de scan listeners. Restrições da situação demandavam utilização do sqlplus, obrigatoriamente.

Convém destacar:
– O escopo deste post é fazer com que os dados sejam ‘escritos’ corretamente no BD, e não corrigir dados que já estão gravados incorretamente.
– O escopo deste post não é fazer a conversão de charset do BD, e sim a configuração de nls_lang do client.
– Antes de reclamar que não tá funcionando, dá uma olhadinha no bônus, lá no final do post.

Basicamente, concluí que a melhor configuração para resolver o problema consiste em:
1) Setar o CHCP para 1252 (código de página)
2) Setar variável NLS_LANG do server para BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252
3) Setar NLS_LANG do Oracle para BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252

OBS: Funciona com outras combinações, mas optei pelo BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252 pois segundo a Oracle (http://docs.oracle.com/html/B13804_02/gblsupp.htm) é o que temos como ‘oficial’ pro “Português (Brazil).”

Vale lembrar que esta configuração pode ser feita diretamente via prompt de comando antes da utilização do sqlplus. Aí o problema já estaria resolvido (:D).
Até aqui o Eduardo Legatti me ajudou 100%. Mas agora pra que a configuração seja permanente no servidor, como faz?

Faz assim:

1)  Configuração CHCP para 1252 por Default:
– Run > regedit

Em [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]:
– Setar o (Default) para c_1252.nls

Default CHCP

–  SetarOEMCP para 1252

set OEMCP

2) Configurar NLS_LANG do Oracle:

Em [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_]:
– Setar NLS_LANG para BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252

NLS_LANG Oracle
3) Configurar o NLS_LANG como variável de ambiente:

Em [My Computer > Properties > Advanced System Settings > Environment Variables]:
– Setar o NLS_LANG para BRAZILIAN PORTUGUESE_BRAZIL.WE8MSWIN1252

set OEMCP
4) Reboot do Servidor:

– Para efetivar mudanças no REGEDIT é necessário reiniciar o server.

Era isso!
Espero que seja útil para mais alguém, assim como foram úteis pra mim os links abaixo:

Nota: Greek Characters Are Not Displayed Correctly In A DOS Window (Doc ID 208902.1)
http://www.leniel.net/2010/03/oracle-nlslang-character-set-encoding.html#sthash.KPuB7Rtg.YxcOtWFd.dpbs
http://docs.oracle.com/html/B13804_02/gblsupp.htm
http://nagaappani.blogspot.com.br/2013/05/setting-nlslang-on-windows-for-oracle.html
http://ss64.com/nt/chcp.html
http://www.fabioprado.net/2012/11/configurando-national-language-support.html
http://tosemopcao.blogspot.com.br/2009/11/bd-oracle-acentos-no-10g-xe.html
http://eduardolegatti.blogspot.com.br/2011/01/habilitando-o-suporte-acentuacao-no.html

Bônus)
Embora as configurações estejam adequadas, a fonte (tipo de letra) do DOS (prompt de comando) pode não suportar os caracteres especiais e acentos. Basta trocar pra “Lucida Console”:

Fonte_Caracteres

Fechado?

Até breve!

GrepOra Team

As already spoken, we are a group of friends that are crazy enough to share our experiences with you and with Oracle community as a payback of our own consumption.

In the next pages you are going to see some of our background and brief description professionally talking. So, by now, we are only going to share some photos of our occasional meetings.

img-20160615-wa0001
(Maiquel, Matheus, Cassiano, Jackson, Dieison and Rafael)
(First GrepOra meeting)

foto
(Maiquel, Rafael, Jackson, Matheus, Dieison and Cassiano)
(Last GrepOra Meeting – by now)

And this is it!
We hope you enjoy the book and the experience.

Let us know what you think about the book and the blog. Reach us out in social media like LinkedIn and Twitter. Collaborate and engage to Community!

Cheers!

About the Book

Hello!

Welcome to our book, our blog and our world to have fun and view/review/learn/laugh with some of our struggles and personal notes for ourselves in the future.

Those posts are basically our notes with some of ours discovers and tips to review in the future. I believe everyone who works with that kind of technology have some personal notes, right? So, ours are being published to share with you.

We believe in sharing and mutual growing, so feel free to reach us to share your notes and tips, to fix anything you think to be wrong or can be better explained or everything. This is not only GrepOra team’s blog. This is our blog. Which includes you.

Ok then. But we are publishing a book? Just why? Who is the target audience? How should I read it? How is it structured? What should I expect?

Why:

This week we are completing 2 Years since the blog was created (in that time, called MatheusDBA). And we decided to review our best moments in these last years and compile them for you. It’s, above all, a good opportunity to refresh some posts that are still actual.

For who:

We are compiling it as a best moments review to engage new readers with the best past posts and reach that readers that enjoy to read a book in their mobile reading devices. Actually, we believe that writing material for this kind of media is the future (or the present), so if you prefer to read PDF files in you Kindle, Ipad, or similar, specially for those who prefer the offline mode to not being bothered by social media notifications, instant messages and other: This is for you. 🙂

How to read:

This is a book generated by the best posts in the blog. If you read the blog you know that the posts are not continuos and mostly have not relation between them. So, this is a book to read some curiosities and tips, to learn and review some useful stuff and to be aware about some daily basis challenges and struggles on working with Oracle technologies. This is not a book to be read in sequence, chapters or something like this. Feel free to read whatever you want and whatever you feel it’s interesting for yourself and to get richer your own experience with Oracle techs… Simple like that.

The structure:

There is no boundaries for our posts and ideas. Of course we have specialities, but everyone can write about everything. So there is no chapters of any restrictedly fixed boundaries. However, to give a little sense, we kind of organized the posts by following this (using our blog categories):

  • Oracle Database, RAC and Dataguard;
  • ASM;
  • Datapump, RMAN, Exp/Imp;
  • Enterprise Manager;
  • Application and Middleware;
  • Golden Gate and Data Integrator;
  • Linux and Shellscripts;
  • Cloud Computing;
  • Heterogeneous Databases;
  • Web Development and APEX;
  • PL/SQL and SQL Scripts;
  • Errors and Bugs.


What to expect:

Basically: “To read some curiosities and tips, to learn and review some useful stuff and to be aware about some daily basis challenges and struggles on working with Oracle technologies”. But mostly: To have fun! This is a book written by Oracle geeks to Oracle geeks.

Welcome to our world!

Author: Cassiano Roloff

20151217100542Innovative in everything he does, Cassiano acts as Oracle DBA since 2007 and works everyday with APEX since 2009. Cassiano is a great teammate and is always willing to help someone and learn new things.

Below you can find his Certifications list.

linkedin-logo_318-50643 https://br.linkedin.com/in/cassianoroloff
new-email-interface-symbol-of-black-closed-envelope_318-62705 cassianoroloff@gmail.co

Certifications:
Oracle Database 10g Administrator Certified Professional – OCP 10g
Oracle Database 10g Administrator Certified Associate – OCA 10g

Author: Jackson Costa

aaeaaqaaaaaaaaldaaaajdq1mjnjowy3lwjkmjytngqwns05njq2ltu0nzzlmdblmtrimqFocused on Fusion Middleware and Application technologies, Jack is friend of everyone and always available to reach out the others. Jack has good architecture comprehension and skills to manage solutions on different technologies.

 

linkedin-logo_318-50643 https://br.linkedin.com/in/jacksonadriano/en
new-email-interface-symbol-of-black-closed-envelope_318-62705 jacksonadriano@gmail.com

Author: Rafael Nolio

rafael3Passionate Database Administrator, experienced as consultant on heterogeneous environments and always trying new ways to do everything. Great as teammate, Rafael is always available to discuss new ideas and innovation.

Below you can find his Certifications list.

linkedin-logo_318-50643 https://br.linkedin.com/in/rafael-nolio-07663438/en
new-email-interface-symbol-of-black-closed-envelope_318-62705 rafael.nolio@gmail.co

Certifications:
Oracle DBA Certified Associate 11g
Oracle Specialist Implementation Certified 11g

Author: Dieison Santos

dieisonProfessional in the IT area since 2006, working with Oracle applications and database. Solid experience in installation, customization and performance tuning of Fusion Middleware products.

Below you can find his Certifications list.

linkedin-logo_318-50643 htps://br.linkedin.com/in/dieisonsantos/en
new-email-interface-symbol-of-black-closed-envelope_318-62705 dieisonpower@gmail.com

Certifications:
Oracle Certified Associate, Oracle WebLogic Server 11g System Administrator

Author: Maiquel Oliveira

aaeaaqaaaaaaaafcaaaajge0nzziytdllty2mmetngmxzc1izme3ltrjztiwzjnlodgzywDetail-oriented, Maiquel has almost a scientific approach in all his duties. Maiquel is the GoldenGate guy, acting focused on Integration Solutions. Maiquel also keep studying and feel comfortable about databases.

 

linkedin-logo_318-50643 https://br.linkedin.com/in/maiqueldc
new-email-interface-symbol-of-black-closed-envelope_318-62705 maiqueldc@gmail.com