Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

1 votes
1 answers
536 views
Mysql row-based binary logging behaving different in some versions of mysql (rows grouping)
Mysql row-based binary logging seems to have a different behaviour when grouping rows changes in some versions of mysql. Let's assume the following statement update three rows: `UPDATE table_name SET a=1 WHERE id IN (1, 2, 3);` In mysql `5.7.21`: The binary log receive **only one log** containing th...
Mysql row-based binary logging seems to have a different behaviour when grouping rows changes in some versions of mysql. Let's assume the following statement update three rows: UPDATE table_name SET a=1 WHERE id IN (1, 2, 3); In mysql 5.7.21: The binary log receive **only one log** containing the 3 rows changes. (Which is my desired behaviour) However, when tested in mysql 5.7.11 and mysql 5.7.26, the same statement produces **three separated logs**. Each one of them containing each changed row. I have checked the system variables and, at least, the ones who are related to the binary log, seem to be exactly the same on 5.7.21 and 5.7.26. We have checked the startup variable --binlog-row-event-max-size, which could be causing the problem. Since the rows in our tables could be bigger than the default 8KB. But, we are not able to set this variable. Since we are working in Amazon RDS. (How can we do it?) I need that the rows that are changed on the same statement are always batched in the binary log. Is there some variable which could be causing this behaviour? Notes: There is no replication involved in our setup.
Leonardo Kuffo (109 rep)
Sep 5, 2019, 02:47 PM • Last activity: Apr 20, 2025, 04:03 PM
0 votes
1 answers
441 views
Environment variable $PGUSER does NOT take effect with Postgresql client?
For many years I have used to use the environment variable `$PGUSER` when I work with client tools such as psql/pg_dump/pg_restore. Recently I build up a new PG13 server, the env var `$PGUSER` does **NOT** take effect, when I try to use the client tools on a terminal of the server. I get message lik...
For many years I have used to use the environment variable $PGUSER when I work with client tools such as psql/pg_dump/pg_restore. Recently I build up a new PG13 server, the env var $PGUSER does **NOT** take effect, when I try to use the client tools on a terminal of the server. I get message like this: > leon@mamba:~$ echo $PGUSER > > postgres > > leon@mamba:~$ psql > > psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: > > FATAL: role "leon" does not exist If I use the tools on a terminal of another physical computer, the env var takes effect normally. Of course, the var has been set on both machines. My pg_hba.conf: > \# TYPE DATABASE USER ADDRESS METHOD > > host all all 127.0.0.1/32 trust > > host all all 192.168.x.x/16 md5 > > \# IPv6 local connections: > > host all all ::1/128 trust
Leon (411 rep)
Oct 21, 2024, 07:22 AM • Last activity: Oct 22, 2024, 01:54 PM
-2 votes
1 answers
22 views
Online docs has incorrect JVM flag unsafe_aggressive_sstable_expiration for TimeWindowCompactionStrategy
I was installing the unsafe_aggressive_sstable_expiration and found out that there is a mistake in the documentation. The documentation told us that we needed to enable in the jvm -Dcassandra.unsafe_aggressive_sstable_expiration=true, while we actually needed to use -Dcassandra.**allow_**unsafe_aggr...
I was installing the unsafe_aggressive_sstable_expiration and found out that there is a mistake in the documentation. The documentation told us that we needed to enable in the jvm -Dcassandra.unsafe_aggressive_sstable_expiration=true, while we actually needed to use -Dcassandra.**allow_**unsafe_aggressive_sstable_expiration=true. I think it is important that this gets fixed because this can led the users to some time loss until they find out the issue. Adding to that, it would be great if you could add some documentation on the procedure to install these tags. For instance, we did not know if these tags needed to be in the cassandra.yaml file or if they had to be in the env-sh file. It was in the second that they needed to be installed, and this led us to some time loss as well. Thanks for your attention
Jon Corral (1 rep)
Jul 4, 2024, 12:43 PM • Last activity: Aug 1, 2024, 03:24 AM
4 votes
1 answers
15198 views
How do I map SSIS 2012 Package Variables to Parameters?
I have created multiple packages that use variables to assign Connection Manager `Expressions` such as `Connection String`. However in the new SQL 2012 [Project Deployment Model][1] I don't seem to be able to configure these variables. Would I therefore need to create these `Parameters` for the `Env...
I have created multiple packages that use variables to assign Connection Manager Expressions such as Connection String. However in the new SQL 2012 Project Deployment Model I don't seem to be able to configure these variables. Would I therefore need to create these Parameters for the Environment and map them to specific Package Variables? Is this even possible and how is this done? This link describes configuring the Parameters, but not associating to **package** Variables. Further to this, it seems I *could* set a Varaiable Expression to be a Project or Package Parameter, however this seems a bit convoluted. Perhaps I should stop using Variables altogether? enter image description here ----- Update: I've now cut-over to using Project-level and Package-level Parameters (instead of Package Variables) when I need to modify per-environment settings such as file paths and connection strings. Perhaps this was the intent from MS: any best practice advice is of course, still welcome.
PeterX (177 rep)
Dec 17, 2013, 06:57 AM • Last activity: Mar 31, 2024, 05:31 AM
0 votes
0 answers
29 views
Environment Variables and MS Machine Learning Services
My apologies in advance if this is a naive or obvious question, but I am relatively new to this sort of thing. Here is my basic set up and dilemma: 1. I have an ETL process that starts with an API call returning XML. The XML needs some extensive processing that is difficult to perform (at least for...
My apologies in advance if this is a naive or obvious question, but I am relatively new to this sort of thing. Here is my basic set up and dilemma: 1. I have an ETL process that starts with an API call returning XML. The XML needs some extensive processing that is difficult to perform (at least for me as it involves quite a bit of REGEX) in SQL, but easy to perform with Python. The Python script writes the result to a SQL Server table. 2. The ETL process needs to be run on a schedule, but my organization wants to keep all scheduled server tasks in one job agent (MS SQL Server Job Agent). 3. MS Machine Learning Services lets one execute Python script on SQL Server, so this seems like the best solution. Dilemma: the Python script needs a server username, password, and a private API key. I do not want to nor should I hardcode these values in, so storing them as environment variables seemed like the obvious solution. I defined these as system variables on the server and tried to access them with MS ML Services to no avail. I am not sure about this, but it seems that ML services creates App Containers for running python script and these containers do not inherit system environment variables. Am I missing something obvious? Thanks in advance for any suggestions/solutions!
Charlie (1 rep)
Jan 16, 2024, 04:24 PM
4 votes
1 answers
3001 views
psql \set an environment variable from the existing shell environment
I want to set up a psql variable from an existing shell environment variable that I can use in later `psql` commands. I found the [`\set`][1] meta-command, but I'm not able to make it use an existing environment variable in Linux: ``` user@localhost# MY_DB='test_database' user@localhost# sudo -u pos...
I want to set up a psql variable from an existing shell environment variable that I can use in later psql commands. I found the \set meta-command, but I'm not able to make it use an existing environment variable in Linux:
user@localhost# MY_DB='test_database'
user@localhost# sudo -u postgres psql
\set dbname ${MY_DB}
\set 
...
dbname = '${MY_DB}'
whereas I would like dbname = 'test_database' on the last line so that I can use it or example like: \connect :dbname; How could I achieve that with pg 15 on debian 11? This is not helping me much because
\set dbname echo ${MY_DB}
is issuing an empty string. This neither, because I'd like to set my psql variable only once in order to avoid redundancy and to reuse it in plenty of psql commands instead of setting it plenty of times with -v in each of those psql commands.
s.k (424 rep)
May 25, 2023, 09:41 AM • Last activity: May 25, 2023, 11:56 AM
1 votes
1 answers
276 views
My subdirectories under $ORACLE_HOME are missing
Im using oracle 11g. I cannot access the software products since they are missing. When I cd to $ORACLE_HOME, there are no files under it. They are missing. I cannot access the sqlplus. What to do in this kind of case? I have input the correct environment and path.
Im using oracle 11g. I cannot access the software products since they are missing. When I cd to $ORACLE_HOME, there are no files under it. They are missing. I cannot access the sqlplus. What to do in this kind of case? I have input the correct environment and path.
beginner_01 (11 rep)
Oct 11, 2022, 01:42 PM • Last activity: Oct 13, 2022, 03:13 AM
1 votes
2 answers
303 views
how to find out if I am in azure or not?
I am talking about sql server here. I can [connect to azure][1]. I can also [manage permissions][2]. But while doing some automation, I need to know if I am in [azure][3] or normal sql. how can I achieve that? I have been using the [@@version][4]. However, [it is said it is not accurate][5]. [1]: ht...
I am talking about sql server here. I can connect to azure . I can also manage permissions . But while doing some automation, I need to know if I am in azure or normal sql. how can I achieve that? I have been using the @@version . However, it is said it is not accurate .
Marcello Miorelli (17274 rep)
Jul 25, 2022, 03:21 PM • Last activity: Jul 25, 2022, 03:38 PM
13 votes
2 answers
19207 views
How can I use an environment variable in a Postgres function?
Let's say I have a windows user environment variable SOME_STRING. Is it possible to use its value in a PL/pgSQL function? If not, do I need to use an untrusted language (like PL/pythonu) or can I use a trusted one? I am on PG 9.2
Let's say I have a windows user environment variable SOME_STRING. Is it possible to use its value in a PL/pgSQL function? If not, do I need to use an untrusted language (like PL/pythonu) or can I use a trusted one? I am on PG 9.2
Neil McGuigan (8653 rep)
Oct 25, 2013, 06:08 PM • Last activity: Jul 5, 2022, 12:30 PM
1 votes
2 answers
1053 views
PostgreSQL-Patroni-Cluster: Installing oracle_fdw, dependency problem
For Oracle to PostgreSQL migrations we're currently looking into ora2pg. However, the performance using either writes to file or direct read from Oracle and write to PostgreSQL have both been very underwhelming. There's not really good information about that, while some parts I found suggested that...
For Oracle to PostgreSQL migrations we're currently looking into ora2pg. However, the performance using either writes to file or direct read from Oracle and write to PostgreSQL have both been very underwhelming. There's not really good information about that, while some parts I found suggested that it could be related to the Oracle-Perl-Driver. In a new version of ora2pg it introduced a new way of converting the data using the Foreign Data Wrapper oracle_fdw. It is written in C and performance benchmarks seem to suggest a much higher performance. For that, we would like to use oracle_fdw. The target for our conversion is a Patroni Cluster setup with 2 nodes and a 3rd witness node using etcd. However, adding oracle_fdw to the Patroni cluster has been difficult and so far unsuccessful. After compiling oracle_fdw, trying to load it gives the following message: > ERROR: could not load library "/usr/lib/postgresql14/lib64/oracle_fdw.so": libclntsh.so.19.1: cannot open shared object file: No such file or directory That library exists on the system, but in the directory of the Oracle Instantclient (/dbdata/oracle/instantclient_19_12). For the library to be found, we think we would need the following standard environment variables added to the postgres process that Patroni starts: export LD_LIBRARY_PATH=/dbdata/oracle/instantclient_19_12 export ORACLE_HOME=/dbdata/oracle/instantclient_19_12 export PATH=/dbdata/oracle/instantclient_19_12:$PATH However, we have been wholly unsuccessful to inject these variables into the postgress process started by Patroni. The process is started using the system user postgres, as seen here: dbserver01 root 6 (/dbdata/oracle/instantclient_19_12): ps -ef|grep postgres root 9236 9120 0 07:56 pts/0 00:00:00 su - postgres postgres 9238 9236 0 07:56 pts/0 00:00:00 -bash postgres 9289 9238 0 07:56 pts/0 00:00:00 psql postgres 9290 27443 0 07:56 ? 00:00:00 postgres: pgcluster2: postgres postgres [local] idle root 9307 9180 0 07:58 pts/1 00:00:00 grep --color=auto postgres postgres 27423 1 0 Mar23 ? 00:01:41 /opt/patroni/bin/python3 /usr/bin/patroni /etc/patroni/postgres.yml postgres 27443 1 0 Mar23 ? 00:00:04 postgres -D /dbdata/pgcluster --config-file=/dbdata/pgcluster/postgresql.conf --listen_addresses=0.0.0.0 --port=5432 --cluster_name=pgcluster2 --wal_level=replica --hot_standby=on --max_connections=100 --max_wal_senders=10 --max_prepared_transactions=0 --max_locks_per_transaction=64 --track_commit_timestamp=off --max_replication_slots=10 --max_worker_processes=8 --wal_log_hints=on The following methods have been tried: * Adding the export statements to the .bashrc of the postgres user * Adding the export statements to the .bash_profile of the postgres user * Adding the export statements to the global /etc/profile of the server * Adding the /dbdata/oracle/instantclient_19_12/ path to the /etc/ld.so.conf Each time Patroni was restarted, and so was Postgres (checked by the ever changing PID), yet the environment always looks like this: dbserver01 root 7 (/dbdata/oracle/instantclient_19_12): cat /proc/27443/environ | xargs -0 -n 1 LANG=en_US.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/var/lib/pgsql LOGNAME=postgres USER=postgres SHELL=/bin/bash INVOCATION_ID=3806a21dfa52455baad431cc2bbfa533 JOURNAL_STREAM=9:5426402 dbserver01 root 8 (/dbdata/oracle/instantclient_19_12): The Patroni documentation has loads of information about Patroni specific environment variables, yet I have so far not found any documentation that helps pass variables to the Postgres process. Copying the dependencies around might work around the problem, however, adding the variables would be the preferred way of fixing the problem. Is there a right or supported way to add environment variables to the postgres process started by Patroni? Edit 1: The installation process was done using a checkout of the repository with the root user, after setting the above mentioned exports, then compiled using make and make install. Here's the output of both commands currently: dbserver01 root 25 (/tmp/oracle_fdw): make make: Nothing to be done for 'all'. goeccdb11l root 26 (/tmp/oracle_fdw): make install /usr/bin/mkdir -p '/usr/lib/postgresql14/lib64' /usr/bin/mkdir -p '/usr/share/postgresql14/extension' /usr/bin/mkdir -p '/usr/share/postgresql14/extension' /usr/bin/mkdir -p '/usr/share/doc/packages/postgresql14/extension' /usr/bin/install -c -m 755 oracle_fdw.so '/usr/lib/postgresql14/lib64/oracle_fdw.so' /usr/bin/install -c -m 644 .//oracle_fdw.control '/usr/share/postgresql14/extension/' /usr/bin/install -c -m 644 .//oracle_fdw--1.2.sql .//oracle_fdw--1.0--1.1.sql .//oracle_fdw--1.1--1.2.sql '/usr/share/postgresql14/extension/' /usr/bin/install -c -m 644 .//README.oracle_fdw '/usr/share/doc/packages/postgresql14/extension/' dbserver01 root 27 (/tmp/oracle_fdw): ls -la /usr/lib/postgresql14/lib64 Edit 2: I've tried the installation again, using make clean and the process of make and make install again: dbserver01 root 11 (/tmp/oracle_fdw): make clean rm -f oracle_fdw.so liboracle_fdw.a liboracle_fdw.pc rm -f oracle_fdw.o oracle_utils.o oracle_gis.o oracle_fdw.bc oracle_utils.bc oracle_gis.bc rm -rf results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/ dbserver01 root 12 (/tmp/oracle_fdw): export LD_LIBRARY_PATH=/dbdata/oracle/instantclient_19_12 dbserver01 root 13 (/tmp/oracle_fdw): export ORACLE_HOME=/dbdata/oracle/instantclient_19_12 dbserver01 root 14 (/tmp/oracle_fdw): export PATH=/dbdata/oracle/instantclient_19_12:$PATH dbserver01 root 15 (/tmp/oracle_fdw): make gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I"/dbdata/oracle/instantclient_19_12/sdk/include" -I"/dbdata/oracle/instantclient_19_12/oci/include" -I"/dbdata/oracle/instantclient_19_12/rdbms/public" -I"/dbdata/oracle/instantclient_19_12/" -I/usr/include/oracle/21/client64 -I/usr/include/oracle/19.14/client64 -I/usr/include/oracle/19.12/client64 -I/usr/include/oracle/19.12/client -I/usr/include/oracle/19.11/client64 -I/usr/include/oracle/19.11/client -I/usr/include/oracle/19.10/client64 -I/usr/include/oracle/19.10/client -I/usr/include/oracle/19.9/client -I/usr/include/oracle/19.9/client64 -I/usr/include/oracle/19.8/client -I/usr/include/oracle/19.8/client64 -I/usr/include/oracle/19.6/client -I/usr/include/oracle/19.6/client64 -I/usr/include/oracle/19.3/client -I/usr/include/oracle/19.3/client64 -I/usr/include/oracle/18.5/client -I/usr/include/oracle/18.5/client64 -I/usr/include/oracle/18.3/client -I/usr/include/oracle/18.3/client64 -I/usr/include/oracle/12.2/client -I/usr/include/oracle/12.2/client64 -I/usr/include/oracle/12.1/client -I/usr/include/oracle/12.1/client64 -I/usr/include/oracle/11.2/client -I/usr/include/oracle/11.2/client64 -I. -I./ -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o oracle_fdw.o oracle_fdw.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I"/dbdata/oracle/instantclient_19_12/sdk/include" -I"/dbdata/oracle/instantclient_19_12/oci/include" -I"/dbdata/oracle/instantclient_19_12/rdbms/public" -I"/dbdata/oracle/instantclient_19_12/" -I/usr/include/oracle/21/client64 -I/usr/include/oracle/19.14/client64 -I/usr/include/oracle/19.12/client64 -I/usr/include/oracle/19.12/client -I/usr/include/oracle/19.11/client64 -I/usr/include/oracle/19.11/client -I/usr/include/oracle/19.10/client64 -I/usr/include/oracle/19.10/client -I/usr/include/oracle/19.9/client -I/usr/include/oracle/19.9/client64 -I/usr/include/oracle/19.8/client -I/usr/include/oracle/19.8/client64 -I/usr/include/oracle/19.6/client -I/usr/include/oracle/19.6/client64 -I/usr/include/oracle/19.3/client -I/usr/include/oracle/19.3/client64 -I/usr/include/oracle/18.5/client -I/usr/include/oracle/18.5/client64 -I/usr/include/oracle/18.3/client -I/usr/include/oracle/18.3/client64 -I/usr/include/oracle/12.2/client -I/usr/include/oracle/12.2/client64 -I/usr/include/oracle/12.1/client -I/usr/include/oracle/12.1/client64 -I/usr/include/oracle/11.2/client -I/usr/include/oracle/11.2/client64 -I. -I./ -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o oracle_utils.o oracle_utils.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -I"/dbdata/oracle/instantclient_19_12/sdk/include" -I"/dbdata/oracle/instantclient_19_12/oci/include" -I"/dbdata/oracle/instantclient_19_12/rdbms/public" -I"/dbdata/oracle/instantclient_19_12/" -I/usr/include/oracle/21/client64 -I/usr/include/oracle/19.14/client64 -I/usr/include/oracle/19.12/client64 -I/usr/include/oracle/19.12/client -I/usr/include/oracle/19.11/client64 -I/usr/include/oracle/19.11/client -I/usr/include/oracle/19.10/client64 -I/usr/include/oracle/19.10/client -I/usr/include/oracle/19.9/client -I/usr/include/oracle/19.9/client64 -I/usr/include/oracle/19.8/client -I/usr/include/oracle/19.8/client64 -I/usr/include/oracle/19.6/client -I/usr/include/oracle/19.6/client64 -I/usr/include/oracle/19.3/client -I/usr/include/oracle/19.3/client64 -I/usr/include/oracle/18.5/client -I/usr/include/oracle/18.5/client64 -I/usr/include/oracle/18.3/client -I/usr/include/oracle/18.3/client64 -I/usr/include/oracle/12.2/client -I/usr/include/oracle/12.2/client64 -I/usr/include/oracle/12.1/client -I/usr/include/oracle/12.1/client64 -I/usr/include/oracle/11.2/client -I/usr/include/oracle/11.2/client64 -I. -I./ -I/usr/include/pgsql/server -I/usr/include/pgsql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o oracle_gis.o oracle_gis.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC -shared -o oracle_fdw.so oracle_fdw.o oracle_utils.o oracle_gis.o -L/usr/lib/postgresql14/lib64 -L/usr/lib64 -Wl,--as-needed -L"/dbdata/oracle/instantclient_19_12/" -L"/dbdata/oracle/instantclient_19_12/bin" -L"/dbdata/oracle/instantclient_19_12/lib" -L"/dbdata/oracle/instantclient_19_12/lib/amd64" -lclntsh -L/usr/lib/oracle/21/client64/lib -L/usr/lib/oracle/19.14/client64/lib -L/usr/lib/oracle/19.12/client64/lib -L/usr/lib/oracle/19.12/client/lib -L/usr/lib/oracle/19.11/client64/lib -L/usr/lib/oracle/19.11/client/lib -L/usr/lib/oracle/19.10/client64/lib -L/usr/lib/oracle/19.10/client/lib -L/usr/lib/oracle/19.9/client/lib -L/usr/lib/oracle/19.9/client64/lib -L/usr/lib/oracle/19.8/client/lib -L/usr/lib/oracle/19.8/client64/lib -L/usr/lib/oracle/19.6/client/lib -L/usr/lib/oracle/19.6/client64/lib -L/usr/lib/oracle/19.3/client/lib -L/usr/lib/oracle/19.3/client64/lib -L/usr/lib/oracle/18.5/client/lib -L/usr/lib/oracle/18.5/client64/lib -L/usr/lib/oracle/18.3/client/lib -L/usr/lib/oracle/18.3/client64/lib -L/usr/lib/oracle/12.2/client/lib -L/usr/lib/oracle/12.2/client64/lib -L/usr/lib/oracle/12.1/client/lib -L/usr/lib/oracle/12.1/client64/lib -L/usr/lib/oracle/11.2/client/lib -L/usr/lib/oracle/11.2/client64/lib dbserver01 root 16 (/tmp/oracle_fdw): make install /usr/bin/mkdir -p '/usr/lib/postgresql14/lib64' /usr/bin/mkdir -p '/usr/share/postgresql14/extension' /usr/bin/mkdir -p '/usr/share/postgresql14/extension' /usr/bin/mkdir -p '/usr/share/doc/packages/postgresql14/extension' /usr/bin/install -c -m 755 oracle_fdw.so '/usr/lib/postgresql14/lib64/oracle_fdw.so' /usr/bin/install -c -m 644 .//oracle_fdw.control '/usr/share/postgresql14/extension/' /usr/bin/install -c -m 644 .//oracle_fdw--1.2.sql .//oracle_fdw--1.0--1.1.sql .//oracle_fdw--1.1--1.2.sql '/usr/share/postgresql14/extension/' /usr/bin/install -c -m 644 .//README.oracle_fdw '/usr/share/doc/packages/postgresql14/extension/' dbserver01 root 17 (/tmp/oracle_fdw): Edit 3: Added a 4th method to get the path into the postgres user process.
0xCAFEBABE (217 rep)
Mar 25, 2022, 07:24 AM • Last activity: Mar 28, 2022, 08:07 AM
0 votes
2 answers
1563 views
Store LDAP bind credentials in environment variables for pg_hba.conf
I am working on setting up LDAP authentication for a PostgreSQL database and have added the following in my `pg_hba.conf` file: ```bash # TYPE DATABASE USER ADDRESS METHOD host all all all ldap ldapurl="ldap://example.local/dc=example,dc=local?sAMAccountName" ldapbinddn="username" ldapbindpasswd="pa...
I am working on setting up LDAP authentication for a PostgreSQL database and have added the following in my pg_hba.conf file:
# TYPE  DATABASE    USER    ADDRESS     METHOD
host    all         all     all         ldap ldapurl="ldap://example.local/dc=example,dc=local?sAMAccountName" ldapbinddn="username" ldapbindpasswd="password"
It works! But now I'd like to store the username and password as environment variables, like I do for most of my config settings. I've tried adding the username and password as $LDAPUSERNAME or "$LDAPUSERNAME" but they aren't inserting any values. Is this possible? Note: The database will be running in a docker container. If I have to run some script to process the pg_hba.conf file before starting the database, I can.
GammaGames (105 rep)
Jan 19, 2022, 11:50 PM • Last activity: Jan 21, 2022, 07:14 PM
2 votes
1 answers
520 views
Environment variables in Postgres C extension
I cannot get environment variable in my PostgreSQL C extension code. For example, this function always returns `111`: #include "postgres.h" #include "fmgr.h" #include PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(myinc); Datum myinc(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char* envar = getenv("MY...
I cannot get environment variable in my PostgreSQL C extension code. For example, this function always returns 111: #include "postgres.h" #include "fmgr.h" #include PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(myinc); Datum myinc(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char* envar = getenv("MYINC"); if (envar) { PG_RETURN_INT32(arg + atoi(envar)); } else { PG_RETURN_INT32(111); } } While this C program works as expected, it prints whatever MYINC is: #include #include int main() { printf("MYINC: %s", getenv("MYINC")); return 0; }
Nikola (35 rep)
Jan 18, 2022, 03:01 PM • Last activity: Jan 18, 2022, 03:05 PM
1 votes
1 answers
1278 views
Mysql - which cnf file to update
I have mysql 8 running on a ubuntu 20.4 server. I want to apply some setting to optimize the database so that it uses less ram for a web application. typically switching of the `performance_schema`. Which `cnf` file I should be adding my settings? When I run the following command I have get the foll...
I have mysql 8 running on a ubuntu 20.4 server. I want to apply some setting to optimize the database so that it uses less ram for a web application. typically switching of the performance_schema. Which cnf file I should be adding my settings? When I run the following command I have get the following information: $ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options" Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf /etc/my.cnf file doesn't exist /etc/mysql/my.cnf contains the following: # # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # # * IMPORTANT: Additional settings that can override those from this file! # The files must end with '.cnf', otherwise they'll be ignored. # !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mysql.conf.d/ ~/.my.cnf doesn't exist. Then I have the following file /etc/mysql/mysql.conf.d/mysqld.cnf # # The MySQL database server configuration file. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # Here is entries for some specific programs # The following values assume you have at least 32M ram [mysqld] # # * Basic Settings # user = mysql # pid-file = /var/run/mysqld/mysqld.pid # socket = /var/run/mysqld/mysqld.sock # port = 3306 # datadir = /var/lib/mysql ... I've added the setting to /etc/mysql/mysql.conf.d/mysqld.cnf file but would be helpful if someone can advise which would be the correct file to add such settings?
adam78 (155 rep)
Jul 6, 2020, 10:54 AM • Last activity: Nov 4, 2021, 07:02 PM
2 votes
2 answers
41496 views
How to change SESSION_CACHED_CURSORS for all sessions
how Can I do to change SESSION_CACHED_CURSORS for all sessions? I found on google and oracle website: `Alter Session...` but I need to changed it for all the session and not only for one of them. How can I do it? UPDATE 1: SQL> alter session set session_cached_cursors=800 scope=both sid='*'; alter s...
how Can I do to change SESSION_CACHED_CURSORS for all sessions? I found on google and oracle website: Alter Session... but I need to changed it for all the session and not only for one of them. How can I do it? UPDATE 1: SQL> alter session set session_cached_cursors=800 scope=both sid='*'; alter session set session_cached_cursors=800 scope=both sid='*' * ERROR at line 1: ORA-02248: invalid option for ALTER SESSION
jcho360 (2009 rep)
Dec 2, 2013, 07:24 PM • Last activity: Aug 13, 2021, 01:00 PM
2 votes
1 answers
120 views
Identifying elements in SSIS package built in MS Visual Studio 2008
I recognize that these are variables, but I am not sure how to add these elements to the package (or how they are added to begin with), what effect that have or even how to manipulate them. No right click, no left click. I can hover the mouse over the element and the tooltip displays the variable na...
I recognize that these are variables, but I am not sure how to add these elements to the package (or how they are added to begin with), what effect that have or even how to manipulate them. No right click, no left click. I can hover the mouse over the element and the tooltip displays the variable name. I can add variables via right click > Edit > Parameter mapping...however that does not display the little icon on the various control flow elements. enter image description here enter image description here I am trying to rebuild this SSIS package. I have very little experience with MS Visual Studio/SSIS/SQL. Thanks for any input.
mcv110 (75 rep)
May 3, 2021, 06:31 PM • Last activity: May 3, 2021, 07:43 PM
0 votes
2 answers
2419 views
Scripts for setting the environment for Oracle Database Multitenant
When working on shared database servers with several Oracle Container Databases installed in different homes and different versions it can be hard to find the pdb you are looking for quickly. We used a shell script to set the environment and I added a DB query function to display the PDBS. Example o...
When working on shared database servers with several Oracle Container Databases installed in different homes and different versions it can be hard to find the pdb you are looking for quickly. We used a shell script to set the environment and I added a DB query function to display the PDBS. Example output: Valid Oracle SIDs are: DBSXX1 SGA: 4900 MB PGA: 1350 MB DBROLE: PRIMARY DBXXX2 SGA: 4900 MB PGA: 1380 MB DBROLE: PHYSICAL STANDBY CDBXX001 [ PDB$SEED PDBXXX1 PDBXXX2 ...] SGA: 64000 MB PGA: 16777 MB DBROLE: PRIMARY CDBXX002 [ PDB$SEED PDBXXX1 PDBXXX2 ...] SGA: 64000 MB PGA: 4443 MB DBROLE: PRIMARY CDBXX003 [ PDB$SEED PDBXXX1 PDBXXX2 ...] SGA: 32000 MB PGA: 11211 MB DBROLE: PRIMARY CDBXX004 [ PDB$SEED PDBXXX1 PDBXXX2 ...] SGA: 32000 MB PGA: 1111 MB DBROLE: PRIMARY CDBXX005: Database offline ... Enter the Oracle SID you require (default: CDBXX001): Oracle SID is now CDBXX001, Oracle Home is /u01/app/oracle/product/19000/) The problem is the performance of the script. The query causes a delay. Are there better solutions to set the environment/display for oracle multitenant ? Improvement ideas? Full script: if [ -t 0 ] function query_db() { export ORACLE_SID=$1 export ORACLE_HOME=grep "^${ORACLE_SID}:" /etc/oratab|cut -d: -f2 -s sqlplus -s / as sysdba<cat /etc/oratab|grep -v "^#"|cut -f1 -d: -s do if [[ $SID == ps -ef | grep -w "ora_smon_$SID" | grep -v grep | cut -d _ -f3 ]] then CDB=$(query_db ${SID} "select cdb from v\$database;") PDBS=$(query_db ${SID} "select name from v\$pdbs;") #DBSIZE=$(query_db ${SID} "select sum (bytes) / 1024/1024/1024 AS SIZE from dba_data_files;") SGA=$(query_db ${SID} "select trunc((sum(value)/1024/1024),-1) SGA from v\$sga;") PGA=$(query_db ${SID} "select trunc((sum(pga_max_mem)/1024/1024),-1) PGA from v\$process;") DBROLE=$(query_db ${SID} "select database_role from v\$database;") if [[ "$CDB" == "YES" ]]; then echo -e "\t\t${SID} "[" "${PDBS}" "]" "SGA:" "${SGA} MB" "PGA:" "${PGA} MB" "DBROLE: " ${DBROLE}" else echo -e "\t\t${SID} "SGA:" "${SGA} MB" "PGA:" "${PGA} MB" "DBROLE: " ${DBROLE} " fi else echo -e "\t\t${SID} : Database offline" fi done DEFAULT=cat /etc/oratab|grep -v "^#"|cut -d: -f1 -s|head -1 echo -e "\nEnter the Oracle SID you require (default: $DEFAULT): \c" read ANSWER [ "${ANSWER}" = "" ] && ANSWER=$DEFAULT export ORACLE_SID=grep "^${ANSWER}:" /etc/oratab|cut -d: -f1 -s export ORACLE_HOME=grep "^${ANSWER}:" /etc/oratab|cut -d: -f2 -s export AGENT_HOME="u01/app/oracle/product/emagent/agent_inst/" export OH=$ORACLE_HOME export DIAG="/u01/app/oracle/product/diag/rdbms/"${ORACLE_SID,,}"/"${ORACLE_SID^^}"/trace" export DIAGS="/u01/app/oracle/product/diag/rdbms/"${ORACLE_SID,,}s"/"${ORACLE_SID^^}"/trace" export TNS_ADMIN="/u01/app/oracle/product/network/admin" NEW_VER=cat /etc/oratab | grep ^\echo ${ORACLE_SID}:\ | cut -d'/' -f 5 export PATH=echo $PATH | sed "s@/u01/app/oracle/[a-z]*/[0-9]*/[a-z0-9_]*@$ORACLE_HOME@g" export LD_LIBRARY_PATH=echo ${LD_LIBRARY_PATH} | sed "s@/u01/app/oracle/[a-z]*/[0-9]*/[a-z0-9_]*@$ORACLE_HOME@g" if [ "${ORACLE_SID}" = "" ] then echo -e "\n\n ${ANSWER} : Invalid Oracle SID \c" sleep 2 fi done else # Set to first entry in oratab export ORACLE_SID=cat /etc/oratab|grep -v "^#"|cut -d: -f1 -s|head -1 export ORACLE_HOME=cat /etc/oratab|grep -v "^#"|cut -d: -f2 -s|head -1 export ORACLE_SID=grep "^${ANSWER}:" /etc/oratab|cut -d: -f1 -s export ORACLE_HOME=grep "^${ANSWER}:" /etc/oratab|cut -d: -f2 -s NEW_VER=cat /etc/oratab | grep ^\echo ${ORACLE_SID}:\ | cut -d'/' -f 5 export PATH=echo ${PATH} | sed "s@/u01/app/oracle/[a-z]*/[0-9]*/[a-z0-9_]*@$ORACLE_HOME@g" export LD_LIBRARY_PATH=echo ${LD_LIBRARY_PATH} | sed "s@/u01/app/oracle/[a-z]*/[0-9]*/[a-z0-9_]*@$ORACLE_HOME@g" export OH=$ORACLE_HOME export AGENT_HOME="/u01/app/oracle/product/emagent/agent_inst/" export DIAG="/u01/app/oracle/product/diag/rdbms/"${ORACLE_SID,,}"/"${ORACLE_SID^^}"/trace" export DIAGS="/u01/app/oracle/product/diag/rdbms/"${ORACLE_SID,,}s"/"${ORACLE_SID^^}"/trace" export TNS_ADMIN="/u01/app/oracle/product/network/admin" fi echo echo Oracle SID is now tput rev$ORACLE_SIDtput rmso, Oracle Home is tput rev$ORACLE_HOMEtput rmso echo
r0tt (1078 rep)
Dec 18, 2020, 08:25 AM • Last activity: Mar 18, 2021, 07:41 PM
0 votes
0 answers
1090 views
Bash Script Can't Connect to Azure Postgres using ENV Vars - "The Username should be in <username@hostname> format"
I have a bash script that [exports ENV vars][1] to use in connecting to an Azure Postgres DB (`mydb.postgres.database.azure.com`). For the user portion of that specifically it looks like this: export PGUSER="postgres@mydb" This works fine to connect to my local DB where the `@mydb` part isn't requir...
I have a bash script that exports ENV vars to use in connecting to an Azure Postgres DB (mydb.postgres.database.azure.com). For the user portion of that specifically it looks like this: export PGUSER="postgres@mydb" This works fine to connect to my local DB where the @mydb part isn't required, but it fails when connecting to Azure (where it is required) with: > psql: FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in format. I've found lots of solutions/answers to this like this one and this one however those aren't viable solutions when using ENV vars to set connection details (and while I didn't expect it to work I nonetheless tried changing my script to export PGUSER="postgres%40mydb" and indeed it did yield the same error). Does anyone know how to accomplish this?
Madbreaks (137 rep)
Sep 28, 2020, 03:39 PM • Last activity: Sep 28, 2020, 08:05 PM
0 votes
1 answers
529 views
Percona-server-5.6.41 and sql_mode
When setting `sql_mode=""` in */etc/mysql/my.cnf* server leaves this variable in it default value: mysql> show variables like 'sql_mode'; +-------------------+------------------------------------------------------------------------+ | Variable_name | Value | +-------------------+--------------------...
When setting sql_mode="" in */etc/mysql/my.cnf* server leaves this variable in it default value:
mysql> show variables like 'sql_mode';

+-------------------+------------------------------------------------------------------------+ 
| Variable_name | Value                                                                                 |
+-------------------+------------------------------------------------------------------------+ 
| sql_mode         | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION  |
+-------------------+------------------------------------------------------------------------+
However, if i set it manually in mysql shell: set global sql_mode=""; server sets it as desired - to empty value. Till next server restart, when server sets this variable to default value again. Tried in single and double quotes - no matter. No errors in error log. No other default configuration files of mysql loaded What's wrong? Why?
Someone (223 rep)
Nov 4, 2018, 02:20 PM • Last activity: Apr 30, 2020, 11:05 PM
2 votes
1 answers
5165 views
Variable to select database in SQL query
If I want use a variable in the `FROM` clause of a SQL query I [need to use dynamic SQL.](https://stackoverflow.com/a/41250925/2112418) Which might be a pain if the query is long and complex. There are few different ways of running a query from a database you are not currently connected to. The two...
If I want use a variable in the FROM clause of a SQL query I [need to use dynamic SQL.](https://stackoverflow.com/a/41250925/2112418) Which might be a pain if the query is long and complex. There are few different ways of running a query from a database you are not currently connected to. The two methods I use most often are these.. Select * from msdb..sysjobs_view or USE MSDB Select * from sysjobs_view If you start on the master database both of the above will give you the same results. When I put these both into dynamic SQL one works and the other does not Starting from master, this works DECLARE @DBN SYSNAME SET @DBN = 'msdb' DECLARE @Sql NVARCHAR(MAX) SET @Sql = N'Select * from ' + @DBN + '..sysjobs_view' EXEC (@Sql) But this does not DECLARE @DBN SYSNAME SET @DBN = 'msdb' DECLARE @Sql NVARCHAR(MAX) SET @Sql = N'USE ' + @DBN EXEC (@Sql) Select * from sysjobs_view I get the error > Msg 156, Level 15, State 1, Line 14 > Incorrect syntax near the keyword 'EXEC'. My reason for this: One line of dynamic SQL in big complex query is going to be less painful to code than trying to turn the whole query into dynamic SQL. My question here is just about why its not working with the USE clause. Why can't I use dynamic SQL with the [USE clause](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/use-transact-sql?view=sql-server-ver15) to change the database context? NOTE: The below does work and would be easy to code. But my question about why remains. DECLARE @DBN SYSNAME SET @DBN = 'msdb' DECLARE @Sql NVARCHAR(MAX) SET @Sql = N'USE ' + @DBN +' Select * from sysjobs_view ' EXEC (@Sql)
James Jenkins (6318 rep)
Nov 13, 2019, 04:59 PM • Last activity: Dec 17, 2019, 06:23 PM
0 votes
1 answers
318 views
Skip_log_bin and innodb_flush_log_at_trx_commit
If I have `skip_log_bin =1` is there any reason for not having `innodb_flush_log_at_trx_commit = 0`? If I have understand correctly, `innodb_flush_log_at_trx_commit`, reads data from log file and stores them to disk in a way according to its value. So if I am not using log (`skip_log_bin=1`) why sho...
If I have skip_log_bin =1 is there any reason for not having innodb_flush_log_at_trx_commit = 0? If I have understand correctly, innodb_flush_log_at_trx_commit, reads data from log file and stores them to disk in a way according to its value. So if I am not using log (skip_log_bin=1) why should I have value other from 0 on innodb_flush_log_at_trx_commit ?
Christoforos (149 rep)
Jul 14, 2019, 06:43 AM • Last activity: Jul 14, 2019, 06:09 PM
Showing page 1 of 20 total questions