I need some help with my instance of Db2 on Cloud. I need to execute a command for setting DB2_COMPATIBILITY_VECTOR. For example I need to define
db2set DB2_COMPATIBILITY_VECTOR=ORA, but I can't do it using IBM DATA SERVER DRIVER or the IBM console.
How can I set it or check that it was already set?
The systems are managed. You can configure Oracle compatibility when you provision the database. There is a option switch in the provisioning form:
That option is not available on the Lite plan because that database is shared.
When you already have provisioned your service instance, you could check some of the values using:
select * from sysibmadm.dbcfg
See DB2_COMPATIBILITY_VECTOR for some database configurations set, e.g., number_compat and varchar2_compat. The should be shown as set in the output.
select * from sysibmadm.dbcfg where name like '%compat'
You can also query environment variables using ENV_GET_REG_VARIABLES:
select substr(reg_var_value,1,20) as VALUE,
substr(reg_var_on_disk_value,1,20) as ON_DISK_VALUE
from table(env_get_reg_variables(-1))
where reg_var_name = 'DB2_COMPATIBILITY_VECTOR'
you can also do...
[db2inst1#fergara ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=my.server
[db2inst1#fergara ~]$ db2set DB2_COMPATIBILITY_VECTOR=ORA
[db2inst1#fergara ~]$ db2set -all
[i] DB2_COMPATIBILITY_VECTOR=ORA
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=my.server
[db2inst1#fergara ~]$
Edit: do not forget to stop and start the DB2 server for those to take effect.
Related
I see Cloud SQL - MySQL has a Database Flag to set the default_time_zone. I cannot however, find how to do the same for Cloud SQL - PostgreSQL. I need my time zone to be UTC.
The flags that you see in Cloud SQL - MySQL in Configuring Database Flags documentation are provided by MySQL. If you click on the flag default_time_zone that you are referring to, then you will see that you will be redirected to MySQL documentation page. For the Cloud SQL - PostgreSQL the flags that you see in the Configuring Database Flags documentation, are provided by PostgreSQL, therefore they don't expose this flag or any similar flag like this.
To change the timezone of the PostgreSQL instance, you have to SSH into it and do it by executing query:
Go to the SQL page on the console and find your PostgreSQL instance.
On the instance's details record you will find three dots at the end. Click and select the option Connect VM. On the right side of your window you will see a tutorial.
Follow the tutorial steps to set up a Compute Engine VM Instance that will be connecting to your PostgreSQL.
After you finish all the steps form the tutorial. Go to the Compute Engine page and SSH to the instance that you created for connecting to the PostgreSQL.
Execute the psql "sslmode=disable dbname=postgres user=postgres hostaddr=[POSTGRESQL_PUBLIC_IP]" to connect to the instance.
Execute the SELECT NOW(); to see the current timezone, that your PostgreSQL is running at.
Execute the SET timezone to 'UTC'; to set the timezone of the PostgreSQL to UTC.
Execute the SELECT NOW(); to verify that the default timezone server updated successfully.
You can also connect to the PostgreSQL from Cloud Shell and skip the part of the VM Instance creation.
I configured my RDS Postgres 9.6.1 instance so, that the pg_stat_activity is loaded via 'shared_preload_libraries' parameter
shared_preload_libraries=pg_stat_statements,pg_hint_plan
The I rebooted my instance and then check if the pg_stat_statements can be loaded. But I get the error:
[55000] ERROR: pg_stat_statements must be loaded via shared_preload_libraries
The command
SHOW shared_preload_libraries;
does not show the pg_stat_statements library.
And therefore the error above still remains.
Does somebody else has got the same issue?
Ran into the same problem today.
Turns out I simply had to reboot the database (via CLI or web interface).
As mentioned on the AWS docs:
When you change a static parameter and save the DB parameter group, the parameter change takes effect after you manually reboot the DB instance.
UPDATE
I tried myself. Added to Parameters->shared_preload_libraries values:pg_stat_statements,pg_hint_plan. Clicked "save changes", agreed on "Apply Immediately". Indeed no effect. When I check DB Parameter Group - it shows modified group, but pg_stat_statements unusable. So I think bad on JS and try aws cli:
aws rds describe-db-instances --db-instance-identifier p5
it reveals that group was not indeed changed!:
"OptionGroupMemberships": [
{
"Status": "in-sync",
"OptionGroupName": "default:postgres-9-5"
}
],
So I did:
aws rds modify-db-instance --db-parameter-group-name with-contrib --apply-immediately --db-instance-identifier p5
aws rds reboot-db-instance --db-instance-identifier p5
aws rds describe-db-instances --db-instance-identifier p5
And It was changed. So I try to:
mon=> create extension pg_stat_statements ;
CREATE EXTENSION
mon=> select count(*) from pg_stat_statements;
count
-------
26
(1 row)
Voila. Not sure if it was Chrome (Version 57.0.2987.133 (64-bit)) feature or JS failure, or me not getting intuitive clicking steps, but I failed to apply changes as well. Please try with aws cli to see if you success there.
PREVIOUS
String requires quotes I think.:
String: In general, enclose the value in single quotes, doubling any
single quotes within the value. Quotes can usually be omitted if the
value is a simple number or identifier, however.
So maybe setting shared_preload_libraries this way will help:
shared_preload_libraries = 'pg_stat_statements,pg_hint_plan'
https://www.postgresql.org/docs/current/static/runtime-config-client.html:
shared_preload_libraries (string)
This variable specifies one or more shared libraries to be preloaded
at server start. This parameter can only be set at server start. If a
specified library is not found, the server will fail to start.
Postgres 9.3 introduces a data checksum feature which can detect corruption in pages. Is there a way to query the database to determine if this is on?
Being hosted on a PaaS system, I don't have access to the actual server to check any configurations settings there. I also only have access to our database and not the main postgres database either. Is there a way to determine if this is on from a psql console only?
show data_checksums;
data_checksums
----------------
off
http://www.postgresql.org/docs/current/static/runtime-config-preset.html
You can use pg_controldata see if your postgresql cluster enable data_checksum.
if version=0 then your cluster disable the function.
And data_checksums parameter add by PostgreSQL 9.3.4, if your postgresql version small than that, you cannt select this guc parameter. you must check it by control file.
pg93#db-172-16-3-150-> pg_controldata |grep checksum
Data page checksum version: 0
From 9.4 on, you can try the following query:
select * from pg_settings where name ~ 'checksum';
https://paquier.xyz/postgresql-2/postgres-9-4-feature-highlight-data-checksum-switch-as-a-guc-parameter/
I have installed IBM DB2 v9.7 on CentOS 6.4. I have a problem with starting db2 to listen on port 50000 (with V10.5 I had any problem, it started by default, but Jazz RTC needs version 9.7). I have googled a little bit around and my current settings are:
[db2inst1#jazz ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2_COMPATIBILITY_VECTOR=MYS
[g] DB2SYSTEM=jazz.local
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=dasusr1
Issuing db2stop and db2start did not help. I'm new to DB2, any help will be really appreciated.
You need to set the DBM parameter SVCENAME:
db2 update DBM CFG using SVCENAME 50000
Restart instance afterwards.
Is it possible to determine the cluster directory being used by a Postgres server, from the server itself -- i.e. the service, (under Windows) was started by something like:
C:\foo\postgres.exe -D "D:\emr\data"
Is there a SELECT query or function one can make to the running server to retrieve the value D:\emr\data?
(For completeness)
And even shorter:
SHOW data_directory;
SELECT setting FROM pg_settings WHERE name = 'data_directory'