Oracle vs db2 create user and table - db2

I'm learning to use the command line db2 to create a simple table.
Oracle will perform the following steps:
CREATE USER user IDENTIFIED BY password;
GRANT ALL PRIVILEGES TO user;
and then just type CONNECT and login, and you can create tables.
All this in DB2 how? I don't understand.

DB2 has different user management than Oracle. DB2 relies on the operating system or solutions like LDAP, there is no CREATE USER command.
I recommend that you start by reading this IBM RedBook about commonalities and differences between the DB2 and Oracle and how to get started.

Related

Prisma/ PostgreSQL: What are are the user privileges required while using Prisma with PostgreSQL?

I am using PostgreSQL as my database along with Prisma as my ORM.It seems to be giving an issue while running the 'prisma migrate' command on the server which seems to be an issue of user database privileges not being present.What are the basic user privileges that are required for Prisma while using Postgres apart from the option of giving full admin rights?
Database user needs to have a CREATEDB privilege for using migrate commands in PostgreSQL.
Here's a reference to privileges needed for each supported database: Reference.

Inserting differntial data into postgresql table from db2 table trough trigger

I am looking the differential data load from db2 tables to PostgreSQL. Is there any free tool? or how I can write the trigger to connect two databases?
will db2_fdw in PostgreSQL will help me to do this?
You can't write to nicknames in triggers in Db2.
You may use SQL Replication to a federated data source (PostgreSQL in you case) depending on your Db2 version.
11.5 Federation for PG
11.1 Federation for PG

Can't create new schema in an OVH postgres

I have a PostgreSQL server on OVH's Cloud DB and have been using its databases for my web apps.
So far so good.
I got a project where It's a requirement to have schemas. Strangely enough, I am unable to create schemas on the user with "Administrator" privileges.
I have prepared scripts using schemas, so I just need to run them on a prepared database but I need a database with schemas to run them.
Here is my process:
Create a new database
Select option "Create user"
Select option for privilages: "Administrator"
Commit configuration
Wait for database creation
Connect to database with the new config via PGAdmin
Run command create schema if not exists "vMobile";
Recieve following error:
ERROR: permission denied for database my-database-dev
SQL state: 42501
I created a ticket for this but the wait is taking too long.
Support answer
Ok, so I got a response from the OVH support and there is no option for the user to create new schemas as their CloudDB enables access only to schema public and mentioned privileges Administrator, Read/Write, Read, None are only applicable to the public schema.
Workaround
My solution to this is to create tables with schema name included in their names
like so:
Desired outcome: "vCommon"."Route"
Workaround: "public"."vCommon_Route"

How to shut down one database in a db2 instance?

I want to shut down one database in a db2 instance with multiple dbs.
I don't want to deactivate the db as it will reconnect when I try to connect. It should be completely shut down so I get a connection error when trying to connect to the db.
This is not a programming question so it can be viewed as off topic.
There are different techniques, each has advantages/disadvantages.
You can quiesce the database and later unquiesce it.
or you can revoke connect rights, and later grant them, but this depends on how well your role separation is done.
or you force off existing applications and then connect in exclusive mode as the instance owner (provided that your applications NEVER connect with instance-owner credentials).
One trick you could use is to temporarily recatalog the database you want to deactivate under a different name; this will prevent applications from connecting to it using the original name, regardless of the authority they use.
First, determine the database path by looking at its catalog entry:
db2 list db directory
The value of the "Local database directory" property is what you need.
Now you can recatalog the database:
db2 uncatalog db orig_db
db2 catalog db orig_db as foobar on <path>
where <path> is the local database directory determined previously.
Once you force all applications currently connected to the database in question you will be able to deactivate the database:
db2 list applications
db2 "force application (<app id 1>, <app id 2>,...)
db2 deactivate db foobar
Later on you can restore the catalog entry to its original value:
db2 uncatalog db foobar
db2 catalog db orig_db on <path>

symmetricsDS and postgresql

I wan't to replicate two databases with symmetricDS,
First, i try to do this tutorial https://www.symmetricds.org/doc/3.8/html/tutorials.html
i have install symmetricDs I have installed symmetricDS on my postgresql serveur.
and execute this commands :
../bin/dbimport --engine corp-000 --format XML --alter-case create_sample.xml
../bin/symadmin --engine corp-000 create-sym-tables
../bin/dbimport --engine corp-000 insert_sample.sql
bin/sym
But No tables was write in my database, and no symmetric table too
Can't you help ?
Verify that the user account provided to connect your SymmetricDS nodes has the ability to create tables. Then I would check the symmetric.log for any obvious errors. By default it would create the tables in the default schema of the user account provided so be sure to check that schema for the tables.