I have Oracle 11 and 19 both configured on same machine as different users has different needs. I need to use Oracle 19 for my user whereas system variable is set to Oracle 11.
When I set user variable as Oracle 19, still it takes 11.
Any idea how can I override system variables with my user variables.
Related
What all i need to change in the DB properties here?
#db.url=jdbc:oracle:thin:#<host>:1522:<sid>
#db.driver=oracle.jdbc.driver.OracleDriver
#db.username=<system>
#db.password=<password>
#db.tableprefix=
I am using Hybris 6.2 and wanted to connect it to Oracle 11g. I have downloaded Oracle11g,SqlDeveloper and made a connection between them. I've copied the Oracle Db server properties into the local.properties file of the Config folder in Hybris.
However i'm not able to understand the steps after that (what all info i need to put in connection properties above, do i have to intialize and upadate again?).
Avoid nasty OCI driver configuration.
Because geffchang's answer only shows the configuration with the OCI driver I'm showing here the most simple configuration with the thin client.
Reference is https://help.sap.com/viewer/a74589c3a81a4a95bf51d87258c0ab15/1905/en-US/551f907063044685a309a8b22f5779c3.html
You already wrote how db.url looks like with thin client by specifying host, port and sid. Here are some examples: jdbc:oracle:thin:#192.168.1.1:1521:orcl jdbc:oracle:thin:#//ora01-ic.mydomain.net:1532/hybris jdbc:oracle:thin:#//ora901scan.de.mydomain.net:1523/shop
db.driver=oracle.jdbc.driver.OracleDriver
username and password should be self explanatory.
Avoid tableprefix. You only need it if you want to have multiple hybris instances within a single DB. But if you need multiple instances you could alternatively also create a second DB in the Oracle DBMS (see difference between DB and DBMS!) and use an additional SID like e.g. hybris2.
That's all: host/ip, port, SID, username and password. Three configuration lines depending on your local environment and one static db.driver setting.
OCI vs. Thin driver
I mostly use the Thin driver. The way the hybris documentation explains the usage of the OCI driver is somewhat nasty (to avoid the term "insecure") by using LD_LIBRARY_PATH instead of using ld.conf.
Using the Thin driver is platform-independent and most easy to configure. Using OCI is the opposite and depends on the OS. OCI with LD_LIBRARY_PATH is targeted towards Linux.
Reference OCI: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/jjdbc/JDBC-OCI-features.html#GUID-A8201BD0-BAED-4C54-B53B-C26C5F295B32
Reference Thin client: https://docs.oracle.com/cd/B28359_01/java.111/b31224/jdbcthin.htm
The JDBC driver
It must be put into bin/platform/lib/dbdriver. Current version at time of this writing is ojdbc8-12.2.0.1.0.jar. Here's a list with other versions and timestamps matching their release dates:
$ ls -lnG ojdbc*jar
-rw-r--r-- 1 501 2739670 Jul 28 2014 ojdbc6-11.2.0.4.jar
-rw-r--r-- 1 501 3397734 Jun 25 2013 ojdbc7-12.1.0.1.jar
-rw-r--r-- 1 501 3698857 Apr 11 2016 ojdbc7-12.1.0.2.jar
-rw-r--r-- 1 501 4036257 Mar 1 2017 ojdbc8-12.2.0.1.0.jar
Other settings
db.pool: The values in geffchang's answer are the default values already set in advanced.properties. You don't need to specify them a second time.
oracle.statementcachesize: In Hybris docs referenced above it is mentioned "Do not set any other value than 0". In fact you don't need to set it at all.
tenant.restart.on.connection.error: Usually you don't need to set it. Keeping it on true (default in advanced.properties) MAY cause your DB to be locked at Hybris startup with wrong password because Hybris will try to connect to DB several times and some Oracle DB admins activate an user lock on e.g. 3rd failed login. In this case ask the Oracle admin to provide the correct password and to unlock the account.
I need to set db_block_size to 16384 in my 64bit machine having 64bit windows 7 OS. I am creating a database through dbca utility. Please help.
But the database is already created? If it is, you can't change it by just altering the parameter value. This is one the parameters that is set at the time of the database creation and stays that way.
What you can do is create a new tablespace and set its block size to a different value.
If indeed you're creating the database, you have to choose the custom template at the beginning of the installation in order to change that value.
The parameter can be edited if you have chosen Custom Template in step 3.
Oracle 12.2 DBCA
We use windows domain authentification to connect our users to Oracle. Most of the time it works fine.
But we ran into unexpected problem.
Some usernames are longer than 30 symbols. So the syntax
CREATE USER OPS$SomeVeryLongDomain/SomeVeryLongLogin IDENTIFIED EXTERNALLY
just don't work.
(os_authent_prefix has a standard value OPS$).
Is it possible to use domain authentification for usernames longer than 30 symbols?
UPD
There definitely is a workaround for Kerberos authentication.
If the user's Kerberos principal name is longer than 30 characters, and up to 1024 characters, then create the user as follows:
SQL> CREATE USER db_user_name IDENTIFIED EXTERNALLY AS 'kerberos_principal_name'
For example:
SQL> CREATE USER KRBUSER IDENTIFIED EXTERNALLY AS 'KerberosUser#EXAMPLE.COM';
But I cannot understand how to use the method for OS authentification and is it possible at all.
os_authent_prefix has a standard value OPS$
Well you can't go beyond 30 characters as that is the limit. Read External Authentication.
The os_authent_prefix parameter affects how Oracle matches a Windows username to an Oracle username when you're not using Windows group membership. Early versions of Oracle used a prefix of OPS$, which you would append to the beginning of the Oracle username used in external authentication. Because Oracle usernames are limited to 30 characters, using an OPS$ prefix effectively limited the username to the remaining 26 characters. To avoid using the OPS$ prefix, the Oracle database parameter file, the init.ora file (in the \%ORACLE_HOME%\database folder), should have the following setting (default Oracle9i and Oracle8i installations are configured to include this setting):
os_authent_prefix = ""
The parameter is provided for backward compatibility. Oracle doesn't recommend adding a prefix, thus the default empty setting is as shown. For a change to the OS_AUTHENT_PREFIX setting to take effect, you must shut down and restart the Oracle database instance.
Are the settings of oracle server like , the nls_date_format,.... attributes (I don't know really how many of these kind settings are there) , will be downloaded to the oracle client running on different machine by connecting to the SQL*plus using server host name?
Or the client will maitain its different set , assuming the client is SQL*Plus.
If the client is having its own settings ,is there any way If I can set the same settings as server. like export all settings from server and import those settings to client.
If the client is SQL Developer , is there any way to maintain the sync. between server settings and client's.
You can query the settings (about 20 variables) from the NLS-Views (NLS_DATABASE_PARAMETERS, NLS_INSTANCE_PARAMETERS, NLS_SESSION_PARAMETERS). By show parameter nls you can view the actual settings in SQL*Plus.
These can be altered by sysdba in several ways:
The database parameters are read from (s)pfile while startup. They can be altered via ALTER SYSTEM SCOPE=SPFILE if you use spfile. If you use pfile you have to edit it manually
The instance parameters are set by ALTER SYSTEM SCOPE=MEMORY and will be lost upon shutdown
Both at once can be altered using SCOPE=BOTH. This will be applied immediately and survive the shutdown
The client can override this for his own session in (at least?) two ways:
Set it for your session by ALTER SESSION in SQL*Plus
Set environment variables before client startup via export NLS_...=... in the shell
The latter overrides the earlier ones, so SESSION beats INSTANCE which eats DATABASE.
For your question: you can use a SELECT * FROM NLS_INSTANCE_SETTINGS and apply these to your current session by ALTER SESSION SET ... for each of these variables (maybe via some PL/SQL procedure). Another way would be just to unset all session parameters so that the instance parameters will be used.
If you do not set any NLS variables (especially NLS_LANG) in your environment, your session should be the same as the instance or the database ones. In practice this will never work as expected as you always have some locale settings that produce weired results in SQLP*Plus. ;-)
I found out my servers, running Oracle 10g, were not initializing with the same NLS_SORT value when using the sqlplus binary.
Is there a way to set the default NLS_SESSION_PARAMETERS for every instance of sqlplus?
PS: The idea is not to do an ALTER SESSION at the beginning of every sql script.
the NLS parameters are specified by the client application. SQL*Plus on windows will have its parameters defined in the registry (same as the ORACLE_HOME where it is installed). On *nix systems the paremeters are defined as environment variable.
You can find additionnal information in the documentation.
Use an ON LOGON trigger to do the ALTER SESSION?
Then you can do it in one place and won't have have to change every client.