12 Temmuz 2014 Cumartesi

ORA-12154: TNS:could not resolve the connect identifier specified

My colleague in my company had a problem to connect to database server due to a change inside TNS file. He requested my help to solve it. After searching oracle's origin sources, i encountered many causes. One of them was ours.The alteration in TNS file that causes this issue in our case has shown with yellow colour.Here what i have googled and found out;

ORA-12154: TNS:could not resolve the connect identifier specified


Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action:
- If you are using local naming (TNSNAMES.ORA file):

- Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)

- Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.

- Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.

- Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.

- If you are using directory naming:

- Verify that "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

- Verify that the LDAP directory server is up and that it is accessible.

- Verify that the net service name or database name used as the connect identifier is configured in the directory.

- Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier

- If you are using easy connect naming:

- Verify that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).

- Make sure the host, port and service name specified are correct.

- Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.





8 Temmuz 2014 Salı

REP-0495 UNABLE TO TOKENIZE THE QUERY


10.1.6 Opening / Running an encoded JSP report

If your JSP report's character encoding (for example, EUC-JP) differs from the character set portion of the NLS_LANG environment variable (for example, JA16SJIS), then you will get the following errors:
  • when running the JSP file:
    REP-6106 or 6104 with javax.servlet.jsp.JspException  (multibyte)
    REP-0495 Unable to tokenize the query (singlebyte)
    
    
  • when opening the JSP file using Reports Builder:
    REP-0069 Internal Error or REP-6106
Workaround
To work around this issue, you must ensure that your JSP report's character encoding matches the IANA encoding corresponding to Reports Builder's character set portion of the NLS_LANG variable.
For example, the JSP report encoding
<%@ page contentType="text/html;charset=EUC-JP" %>
<META http-equiv="Content-Type" content="text/html;charset=EUC-JP">

uses the IANA character encoding EUC-JP. For this report, you should use the NLS_LANG setting
NLS_LANG=JAPANESE_JAPAN.JA16EUC.
The JSP report's encoding (EUC-JP) will then correspond to the character encoding part of the NLS_LANG environment variable (JA16EUC).

10.1.7 Dynamically Embedding a Character Set in a JSP file

In Oracle Reports, Web-report templates are configured by default for Western European character encoding. For other languages, you must specify the character encoding for a JSP file by using both the charsetattribute of the <meta> tag and the <%@page%> page directive.
To dynamically associate the appropriate character encoding with the JSP file, you can make the following modifications:
  1. In the directory oracle_home/reports/templates/, edit the files rw*.html and blank_template.jsp:
    1. Modify the page directive to read
      <%@ page contentType="text/html;charset=yourIANAencoding" %>
      
      
      where
      yourIANAencoding is the IANA character encoding that corresponds to the character encoding part of your NLS_LANG environment variable.
    2. Modify the <meta> tag inside the <head> tag to read:
      <meta http-equiv="Content-Type"
      content="text/html;charset=yourIANAencoding" />
      
      
  2. In the directory oracle_home/reports/templates/, edit the file template.xsl:
    1. Modify the <xsl:output> tag to read:
      <xsl:output
           method="jsp"
           indent="yes"
           encoding="yourIANAencoding"
         />
      
      
      where
      yourIANAencoding is the IANA encoding that corresponds to the character encoding part of your NLS_LANG environment variable.
    2. Add the following page directive:
      <%@ page contentType="text/html;charset=yourIANAencoding" %>
      
      
    3. Add or modify the <meta> tag inside the <head> tag:
      <meta http-equiv="Content-Type"
      content="text/html;charset=yourIANAencoding" />
      
      
      where
      yourIANAencoding is the IANA encoding that corresponds to the character encoding part of your NLS_LANG environment variable.

There was an explanation in oracle documentation website about the error written in title and it helped me out a lot to overcome it.
As much as i analyzed i came up with a result showing me that one file which is necessary to call IANA Encoding to match with NLS_LANG variable was not even able to be found at remote computer. I did the same search for these files on my own computer. I found them out. 

You have to look at your own oracle files path first. Here mine was;

C:\oracle\BIToolsHome_1\reports\

Template.xsl file path;

C:\oracle\BIToolsHome_1\reports\templates.xsl

blank_template.jsp

C:\oracle\BIToolsHome_1\reports\blank_template.jsp


HERE THE PICTURES ARE AND THE DETAILS WHICH HAS TO BE CHECKED OUT
                                                                blank_template.jsp




template.xsl



TO SOLVE IT FOR REMOTE COMPUTER I TRIED MORE THEN ONE NLS_LANG VARIABLES FROM REGISTRY. IT IS IN 

HKEY_LOCAL_MACHINE/SOFTWARE 
LOOK IT UP BY CTRL+F TYPE NLS_LANG 

I TRIED TWO OF THEM. IT ALL WORKED

1-AMERICAN_AMERICA.UTF8

AND

2-TURKISH_TURKEY.TR8MSWIN1254 



THERE YOU GO!


10 Haziran 2014 Salı

It Is Another Question


I had solved graphical resolution problem in oracle linux server at my company and i had also mentioned in my previous publish how i solved it. Here we had another problem after solving this isssue.The problem was to enter manually the kernel code at each restart. This was a struggle to rewrite appropriate code into kernel to get rid of it. Briefly,this was what the problem was.

I forgot my password for entry then started searching how to break password and define another one. There i found mysefl at kernel coding once again.

You just need to open single-user-mode from kernel. How you can do it is to write to the very end of line
1 or single.

For instance,  .....nomodeset 1 
                     .....nomodeset single

Then it opens up automatically the single-user-mode.

Secondly, you will write simply;

#passwd (username)
Then rewrite password twice to confirm it.

username in here is the user that you are trying to enter the computer.


#passwd root
***
***
#passwd oracle
***
***

I just decided to change 'root' and 'oracle' username which i basicly use as a username. Root is a base username which gives you privileges to do adjustments in system with an expanded mode. It even gives you priveleges to change system file which i had struggles to change before with another username (oracle).

SO BASICLY WE NEEDED TO SET 'NOMODESET' VALUE IN KERNEL AS A DEFAULT

not to rewrite it at each restart by entering GRUB.


There is file in /etc/grub.conf which you can set this value as a default at kernel.

Easily we can put this value inside this file to the very end of two kernel lines. Because there are two kernel lines which has to be altered.

The code was like as i wrote below;

rhgb quiet nomodeset



But here we have another question,

Is it that easy to break root password to have priveleges which we can do anything we want in server system?


It Is Another Question


21 Mayıs 2014 Çarşamba

Oracle Linux Server Red Hat Nash Version Screen Resolution Problem

My colleague in my company assignmed to search about resolution problem on screen about Oracle Linux Server which is Red Hat Nash 5.1.19.6 version.  I have solved problem. The main cause was the configuration between graphic adapter and linux graphic settings. So the solution is to change kernel settings.

To do this, you need to restart your computer before bios setup showing page and you need to keep pushing F8 (It might differentiate from computer to computer,it was SHIFT button at another computer mentioned in an article which i read). After that you will choose kernel option  with 'E' button.because there will be three options. 'E' button means EDIT. Then you need to find code ending with 'rhgb quiet'.After i removed and added 'nomodeset' code, i boot server again then THERE YOU GO!


                                                          This was the first situation


                                           
                                                                      Result :)

13 Mayıs 2014 Salı

USE OF SOME PL/SQL FUNCTIONS IN SQL



ID1         ID2                  GNDR

5416             WOMEN WOMEN
5418     2290753          WOMEN

Here we have an instance table above and its name is GENDER also its coloumns names are ID1,ID2,GND4

LTRIM() function removes all specified characters from left side of first value shown inside function

SELECT LTRIM(gndr,'W') from GENDER;

Result;

OMEN WOMEN
OMEN

SELECT LTRIM (gndr,'WO') FROM GENDER

Result;
MEN WOMEN
MEN


RTRIM() function removes all specified characters from right side of first value shown inside function

SELECT RTRIM(gndr,'W') from GENDER;

Result;
OMEN WOMEN
OMEN


SELECT RTRIM (gndr,'EN') FROM GENDER

Result;
WOMEN WOM
WOM


NVL() function decides about returning value if specified value is null


SELECT NVL(ID2,0') FROM GENDER;

Result;

0
2290753

TRUNC() function to truncate some values from right side;

SELECT SYSDATE FROM DUAL;
Result;
will be
13/05/2014 15:59:55

SELECT TRUNC(SYSDATE) FROM DUAL;

Result;

13/05/2014

TRUNC() function also is used for some other reasons;

SELECT TRUNC(135.45,1) FROM DUAL;
Result;
135,4

SELECT TRUNC(135.45,0) FROM DUAL;

Result;
135

SELECT TRUNC(135.45,2) FROM DUAL;

Result;
135,45

SELECT TRUNC(135.45,-1) FROM DUAL;

Result;
130

SELECT TRUNC(135.45,-2) FROM DUAL;

Result;
100

SELECT TRUNC(135.45,-3) FROM DUAL;

Result;
0

9 Mayıs 2014 Cuma

Secured Entities and Tables in Oracle

When i study on Human Resources tables in my company's database, i have encountered some thing new inside a view which i guessed that it was a table :)
Its name is HR_ORGANIZATION_UNITS but here is a significant detail; this is not a table. This is a view and it does have a APPS prefix which is used for views in oracle.What caused me searching this is similarities with HR.HR_ALL_ORGANIZATION_UNITS table I asked why these both tables have same names and contents.Here is wrong aprroach.The first one is not table.Once again it is a view. So when i search it from oracle documentation web site i faced security subject. Oracle has some restrictions on restricted users on some tables having these entities.

Some oracle documentation findings which might be usefull;

'Restricted security profiles can optionally make use of read-only, or reporting users. These are separate Oracle User,one per restricted security profile, that have read-only access to Oracle tables and view. Reporting users do not have execute privilege on Oracle HRMS PL/SQL packages, and do not have direct access to the secured Oracle HRMS tables.'

  • Organizations
  • People
  • Assignments
  • Positions
  • Vacancies
  • Payrolls
All other entities are unrestricted;that is restricted security profiles can access all records of tables,views and sequences associated with these entities.


The following Oracle HRMS tables are secured:

  • HR_ALL_ORGANIZATION_UNITS
  • PER_ALL_POSITIONS
  • HR_ALL_POSITIONS_F
  • PER_ALL_VACANCIES
  • PER_ALL_PEOPLE_F
  • PER_ALL_ASSIGNMENTS_F
  • PAY_ALL_PAYROLLS_F
Some of these tables (namely PER_ALL_PEOPLE_F,PER_ALL_ASSIGNMENTS_F,HR_ALL_POSITIONS_F and PAY_ALL_PAYROLLS_F)are datetracked. The following table details the views that are based on the
secured tables listed above.


HR_ORGANIZATION_UNITSSecure view of Organization table
HR_ALL_ORGANIZATION_UNITSOrganization table
PER_ORGANIZATION_UNITSSecure view of Organization view (HR Orgs only)
PER_ALL_ORGANIZATION_UNITSUnsecured view of Organization view (HR Orgs only)
HR_ALL_POSITIONSUnrestricted view of datetracked Positions table, effective at session date
HR_ALL_POSITIONS_FDatetracked Positions table
HR_POSITIONSSecure view of datetracked Positions table, effective at session date
HR_POSITIONS_FSecure view of datetracked Positions table
HR_POSITIONS_XSecure view of datetracked Positions table, effective at system date
PER_POSITIONSSecure view of non-datetracked Positions table
PER_ALL_POSITIONSNon-datetracked Positions table
PER_VACANCIESSecure view of Vacancies table
PER_ALL_VACANCIESVacancies table
PER_ASSIGNMENTSSecure view of Assignments table, effective at session date
PER_ASSIGNMENTS_FSecure view of Assignments table
PER_ASSIGNMENTS_XSecure view of Assignments table, effective at system date
PER_ALL_ASSIGNMENTSUnrestricted view of Assignments table, effective at session date
PER_ALL_ASSIGNMENTS_FAssignments table
PER_PEOPLESecure view of Person table, effective at session date
PER_PEOPLE_FSecure view of Person table
PER_PEOPLE_XSecure view of Person table, effective at system date
PER_ALL_PEOPLEUnrestricted view of Person table, effective at session date
PER_ALL_PEOPLE_FPerson table
PAY_PAYROLLSSecure view of Payrolls table, effective at session date
PAY_PAYROLLS_FSecure view of Payrolls table
PAY_PAYROLLS_XSecure view of Payrolls table, effective at system date
PAY_ALL_PAYROLLSUnrestricted view of Payrolls table, effective at session date
PAY_ALL_PAYROLLS_FPayrolls table







23 Nisan 2014 Çarşamba

ORA-01031 unsufficient privileges

When i try connect to database,i had "ORA-01031 unsufficient privileges" error from command prompt.There are some mistakes that cause this error as i understand.


MY EXPERIENCES

I had installed database software with only "Create Software Only" option. Then i created database from Database Configuration Assistant. As i guessed, there occured some administrative problems because when i check other styles of installing from youtube,there was a password entry under "Administrative Password" with creating database option meanwhile installing.So do installation step by step by creating database option.Otherwise, there will be some configuration problems when you try to connect to database with 'sqlplus / as sysdba' command.

Then I installed database by creating database option to my other PC then the problem solved automatically.
There also might occur some problems about creating TNS AND LISTENER files. Because when you create database while installing software, it creates these files automatically.Once again,software must be installed with database creation option in my opinion.Even though i had solved this problem with some tricks as i mentioned below.


OTHER SOLUTIONS

Even though i had errors as i mentioned above. I solved it with another tricks. Here is the problem                       


TRICK 1: You can connect with 'sys' username to database as 'sysdba' with conn sys / as sysdba command as shown here.


TRICK 2: 

Connecting database with Local Naming Method ''sqlplus UserName@DatabaseName' then you will enter password;


Another style of Local Naming Method "sqlplus UserName/Password@DatabaseName" then it will connect database automatically;