Tag: Oracle

Connecting to Microsoft SQL Server database from Oracle SQL Developer

If you work primarily with Oracle databases, you may use SQL Developer. But you may also need to connect to Microsoft SQL Server databases and not necessarily want to install a new front-end database tool, such as Microsoft SQL Server Management Studio (SSMS).  You can connect to SQL Server from SQL Developer.

First, download the appropriate JDBC Driver for the version of SQL Server that you need to connect to. Then follow the steps in the video at the link below on the Oracle website.

https://www.oracle.com/technetwork/developer-tools/sql-developer/sql-server-connection-viewlet-swf-089886.html

Good luck.

 

Work-around Solution for Oracle Database Error ORA-01792: maximum number of columns in a table or view is 1000

When you get this Oracle database error message …

Error message: Caused By: java.sql.SQLSyntaxErrorException: ORA-01792: maximum number of columns in a table or view is 1000

This may be a solution for you …

There is a workaround … set the “_fix_control” parameter to ‘17376322:OFF‘.

You can use one of the following statements to set the parameter:

alter session set "_fix_control" = '17376322:OFF';

or

alter system set "_fix_control" = '17376322:OFF';

More information can be found in the following Oracle Documents –  Doc ID 1956038.1 and Doc ID 1951689.1.

Working with special character letters in Oracle database (grave accent, acute accent, circumflex accent, tilde, and umlaut)

We have some external data feeds that we receive as csv files, and we load them into our data warehouse and process them.    It turns out that data values that include special characters were getting messed up at some point before or during the load to the Oracle database.

In this post, I will go over one way to select, insert or update data values that contain these special characters.  The “special characters” I am referring to are the grave accent, acute accent, circumflex accent, tilde, and umlaut.

The most common one we come across is the “acute accent” which is present in words such as café or entrée (accent over the e in both words).

If you want to insert these words without the accents, into an example table, WORDS, with a single column, SPECIAL_CHAR_WORD, it would simply be:

insert into WORDS (SPECIAL_CHAR_WORD) values ('cafe');
insert into WORDS (SPECIAL_CHAR_WORD) values ('entree');

But if you want to insert these words with the accents, then you would need to do this:

insert into WORDS (SPECIAL_CHAR_WORD) values UNISTR('cafe301');
insert into WORDS (SPECIAL_CHAR_WORD) values UNISTR('entre301e');

To select the word café with the accent, run this statement:

select UNISTR('cafe301') from dual;

Once a column value is already in a table in the proper format, you can simply select the column name using a normal SQL select statement, and the output will show properly (maybe with just the need for some formatting as you will later in the article).

And for update – to update the word entree with the word entrée, run this statement:

update WORD set SPECIAL_CHAR_WORD = UNISTR('entre301e') where SPECIAL_CHAR_WORD = 'entree';

To see several special characters (grave accent, acute accent, circumflex accent, tilde, and umlaut), run this statement …

select UNISTR('bare300ge') from dual   -- barège    -- grave accent
union
select UNISTR('entre301e') from dual   -- entrée    -- acute accent
union
select UNISTR('pa302turer') from dual  -- pâturer   -- circumflex accent
union
select UNISTR('jalapen303o') from dual -- jalapeño  -- tilde
union 
select UNISTR('fu308r') from dual;          -- für    --umlaut

… the output would look like this … which seems not quite right …
Special_Characters_UNISTR

Add the COMPOSE statement (which is just for formatting) as shown below …

select COMPOSE(UNISTR('bare300ge')) as SPECIAL_CHAR_WORD from dual   -- barège    -- grave accent
union
select COMPOSE(UNISTR('entre301e')) from dual   -- entrée    -- acute accent
union
select COMPOSE(UNISTR('pa302turer')) from dual  -- pâturer   -- circumflex accent
union
select COMPOSE(UNISTR('jalapen303o')) from dual -- jalapeño  -- tilde
union 
select COMPOSE(UNISTR('fu308r')) from dual;     -- führer    --umlaut

and the output will look like this …

Special_Characters_UNISTR_and_COMPOSE2

As  you can see, the key to this is knowing the code for the special character you need, and then using the UNISTR function to add the special character to the rest of the text, and if necessary, use COMPOSE for display purposes.

Thanks for reading. Hope you found this helpful.

How to determine your database version for various RDBMS’s: Oracle, SQL Server, MySQL, DB2

Occasionally you may need to check one of your database’s version for the purpose of creating a ticket with the software vendor, for checking compatibility with other software, preparing for upgrades, getting database client software, and other reasons.

Below are commands for identifying the version of your database for a few of the more popular RDBMS’s.  Please keep in mind that these may or may not work on your version of database or type of operating system.

RDBMS_popular_relational_databses

ORACLE

  • SELECT * FROM V$VERSION;

Your output will be something like this …
version_output_oracle

SQL SERVER

Try one of the following:

  • Select “Help -> About” from the SQL Server Management Studio menu.
  • select @@version
  • You may also connect to the server by using Object Explorer in SQL Server Management Studio. After Object Explorer is connected, it will show the version information in parentheses, together with the user name that is used to connect to the specific instance of SQL Server.

MYSQL

Try one of the following:

  • shell> mysql –version
  • mysql> SHOW VARIABLES LIKE ‘%version%’;
  • mysqladmin version  -or- mysqladmin –v

DB2

Try one of the following:

  • SELECT * FROM TABLE(SYSPROC.ENV_GET_INST_INFO());
  • SELECT GETVARIABLE(‘SYSIBM.VERSION’) FROM SYSIBM.SYSDUMMY1;

Troubleshooting OBIEE 11g

A couple tips on how to resolve some OBIEE 11g errors. When you receive an error such as …

“Supplementary information regarding operation: PROCESS:instance1:coreapplication_obisch1;FAILED_TO_START;
Operation Failed: start; OracleInstance: instance1; Component: coreapplication_obisch1; msg: 0 of 1 processes
started.”

or this …

“Error 500–Internal Server Error
From RFC 2068 Hypertext Transfer Protocol — HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.”

1. First check to make sure your database instance and Listener are up and running.
You can do this through Enterprise Manager by connecting to the server/port.
https://hostname:1158/em/

If they are not running, then start them.
On Windows, you may need to make sure that the following Services are running:
. OracleServiceORCL
. OracleOraDb11g_home1ClrAgent
. OracleOraDb11g_home1TNSListener

2. Then check the status of other OBIEE components.
You can do this through the OBIEE Enterprise Manager.
http://hostname:7001/em/ then navigating to Business Intelligence -> coreapplication -> Availability tab.

or by running the opmnctl command as below
[Drive][FMW_HOME_DIR]instancesinstance1bin>opmnctl status
for example C:obiee11ginstancesinstance1bin> opmnctl status

In the example below, the BI Scheduler (coreapplication_obisch1) and the BI Presentation Server (coreapplication_obips1) are down.

Processes in Instance: instance1
———————————+——————–+———+———
ias-component | process-type | pid | status
———————————+——————–+———+———
coreapplication_obiccs1 | OracleBIClusterCo~ | 10136 | Alive
coreapplication_obisch1 | OracleBIScheduler~ | N/A | Down
coreapplication_obijh1 | OracleBIJavaHostC~ | 8396 | Alive
coreapplication_obips1 | OracleBIPresentat~ | N/A | Down
coreapplication_obis1 | OracleBIServerCom~ | 6736 | Alive

You can start the individual components using Enterprise Manager interface, or you may Stop BI Services and then Start BI Services from the Windows Start button
(Start -> All Programs -> Oracle Business Intelligence -> Stop/Start BI Services).