When the synchronous_commit parameter is used in standalone and primary/standby modes, are the meanings of the values local and on different? - open-gauss

When the GUC parameter synchronous_commit of the openGauss database is used in standalone and primary/standby modes, are the meanings of the values local and on different?

Yes, about openGauss the meanings of the values local and on are different when the synchronous_commit parameter is used in standalone and primary/standby modes. In standalone mode, the local value means that the transaction is committed locally, while the on value means that the transaction is committed on the primary server. In primary/standby mode, the local value means that the transaction is committed on the primary server, while the on value means that the transaction is committed on both the primary and standby servers.

Related

How to apply changes to the standby database in Oracle dataguard without using the commit command

I have setup a data guard on two separate servers (primary and standby).
All the steps have been completed and when I make a change in the primary database and commit, it is also applied to the standby server.
Now I want it to be OK without committing the changes on the standby server.
For example, if a record is inserted in the primary database table, that record will also be inserted in the standby database table and there is no need to commit.
I have not found a solution.
Lets put aside the standby for a second. If you make a change on a database and commit it, that the change is now there permanently. If you do not commit, it can be considered as never happened, ie, you rolled it back, or not yet happened (the transaction is open).
Having a standby or not does not impact this fundamental premise.

Oracle package global variables with multiple sessions

I have an Oracle Package with some Global Variables which are initialized and used on all procedures of that package.
When I call the procedures (via jdbc connection and calls) the global variables are correctly initialized and their values persists through all procedures on the database session that was opened, but when I have multiple jdbc connections it seems that the global variables values are mixed between the calls.
Isn't Oracle sessions isolated in terms of packages variables? Is there some configuration that I need to do on the database or user profile to guarantee that isolation?
My DB Instance is in a RAC with 2 nodes.
Each database session has its own set of variables, yes.
I would expect that your Java application is using a connection pool such that your Java application is constantly getting connections from the pool and returning them to the pool. If that's the case, there is no relationship between a Java session and an Oracle session. A particular Java session might use Oracle session A for the first call, Oracle session B for the second call, C for the third call, and B again for the fourth call. And other sessions would be doing the same thing so the state of session B might have changed between the two calls because some other Java session used it in the interim.
Some connection pool implementations explicitly clear out package variables when a session is returned to the pool so that data doesn't leak from one session to another. Other implementations would allow the different Java sessions to see the package variables in whatever state they happen to be from the prior call. In either case, maintaining state in packages as part of an enterprise Java application is a bad idea.
It is possible that you want a global context instead but it's hard to know that for sure since we don't know what problem you're trying to solve with your package variables.

How to keep session parameters upon switching to another RAC node?

I have Oracle RAC 10g environment with two nodes.
On connection we set the session TIME_ZONE using ALTER SESSION.
But, on switching the session to another node , RAC lost TIME_SONE settings.
How to keep session parameters upon switching to another RAC node?
Tx
If you're talking about Transparent Application Failover there is probably no easy way to do this:
You must also reexecute any session customizations, in other words,
ALTER SESSION statements, after failover has occurred.
There may be workarounds, depending on how you set the session settings. For example, if all the relevant sessions come from the same application, computer, etc., you can use a logon trigger that sets the same settings. You can find the relevent session using v$session.failed_over = 'YES', and matching other relevant columns in v$session.

Settings in Oracle client and Server

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. ;-)

Oracle Data Guard - What are the changes to make on standby database which is a mirror copy of the primary database

After setting up primary database which is setup with Raid1. I break the mirror and physically transfer it to the standby database hardware and did a Raid1 sync. With that I have exact replicate of the primary database on the standby database.
However, since the standby database's data is exactly the same as primary database, I have to change it to become the standby database.
example:
Primary database server oracle_sid=chicago
Standby database server oracle_sid=chicago (since its a replicated data)
I need to change the standby database oracle_sid to boston.
I believe it is not a simple case of changing the oracle_sid to boston since the database name is chicago.
Appreciate any specific and detailed steps to make the changes.
You should probably ask this on Serverfault. However, I'll mention here using Recovery Manager (instead of your method) to create the standby database will eliminate most of the manual work in renaming the database, recreating the control files, etc.

Resources