I have connected to db2 with the id and password I used to create the Sample database. I am trying to drop a schema that I accidentally created.
I used the following.
SQL> drop schema TGR RESTRICT;
where TGR is the name of the schema I am trying to drop.
I am getting this error
ERROR near line 1:
SQL0551N The statement failed because the authorization ID does not have the
required authorization or privilege to perform the operation. Authorization
ID: "DB2ADMIN". Operation: "DROP SCHEMA". Object: "TGR ".
DB2ADMIN is the id that was used to create the Sample database to start with.
I am running DB2 version 10.5 Express-C on Windows 7 Professional.
Related
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"
I have a Oracle Database 12C and, when i do the following query on SYS schema
select * from all_users;
i get listed USER_X.
However, when i try to alter USER_X's password, by doing the following
ALTER USER USER_X IDENTIFIED BY XPTO_123;
i get the error
SQL Error: ORA-01918: 01918. 00000 - "user '%s' does not exist"
Am i missing something?
Thanks
How was the 12C database installed? Does it uses the "Multitenant" architecture?
If so, alter the user's password may differ for CDB and PDB.
You can refer to this and this links for more infos.
I created a foreign data wrapper and created the user mappings for 2 users one is admin and the other only has readonly access to the tables.
When I try to query using the readonly user I get an error:
ERROR: permission denied for schema testing LINE 1: SELECT * FROM testing.bldg ^ ********** Error ********** ERROR: permission denied for schema testing SQL state: 42501 Character: 15
Here is my setup:
Postgres 9.6.1 in Amazon RDS, both DBs are part of same AWS RDS instance.
When I connect to remote database directly using the readonly user I am able to query the table, problem only happens when using the fdw.
As the readonly use when I query this "select * from pg_foreign_table;"
I see all the foreign tables.
I have tried the following:
grant usage on schema ...
grant select on table...
GRANT USAGE ON FOREIGN SERVER ...
Any ideas.
I was able to resolve the issue, here are the steps:
create readonly user on local DB
create readonly user on remote DB
create fdw and user mapping for readonly user
grant usage privs on remote and local db (I was missing this on local)
grant select privs on local and remote db to readonly user.
Extracted code from documentation,
create table sales_catalog(
item_id varchar(10) not null primary key,
item_name_desc varchar(50) not null,
item_desc varchar(50));
Error after using SYSDBA as the user in Firebird SQL3.
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
CREATE TABLE SALES_CATALOG failed
There is no privilege for this operation.
I did some experimenting, and the problem seems to be that if you connect to a database using ISQL without specifying a host name, it will use Firebird embedded to connect to the database (previous versions of Firebird didn't do that on Windows).
Firebird embedded does not require a username and password as it assumes that if you have direct read/write access to the database, that you are allowed to connect to it.
When you connect without specifying a username and password (eg using connect 'database.fdb' instead of connect 'database.fdb' user sysdba, Firebird embedded will use your OS username to connect.
This can be checked because ISQL reports the username when connecting:
SQL> connect 'd:\data\db\fb3\dbofnormal.fdb';
Database: 'd:\data\db\fb3\dbofnormal.fdb', User: MARK
Firebird 3 added new metadata privileges, for example creating a table in a database now requires that you are either the owner of the database (the username used in the create database statement), sysdba (or another admin user), or that you have the create table privilege. See also User Privileges for Metadata Changes. In earlier version any user would be allowed to create tables once they had access to the database.
Now on to the problem: the user (in my example MARK), does not have the create table privilege, so attempting to do so will fail:
SQL> create table testmark ( id integer generated by default as identity primary key);
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-CREATE TABLE TESTMARK failed
-There is no privilege for this operation
There are a few ways to solve this:
Specify a user with sufficient privileges in the connect statement (eg sysdba):
connect 'database.fdb' user sysdba;
Include the host name in the connect statement to connect through Firebird server instead of Firebird embedded, so that you are required to specify user name and password:
connect 'localhost:database.fdb' user sysdba password 'masterkey';
Connect once to your database as sysdba (see first item), and give the necessary privileges to the user (in my case mark):
grant create table to user mark;
From this moment forward this user can create tables (you may need to grant additional privileges, eg create view, create procedure, etc).
I am trying to edit PostgreSQL schema script and make it executable in Oracle (Oracle Express). In PostgreSQL were under the each CREAT TABLE these commands:
ALTER TABLE table_name OWNER TO user;
For example table_name is appuser and user is projectX.
The table is successfully created, but there is an error: ORA-01735: invalid ALTER TABLE option
I have also created another user in my scheme (projectX), but the error is still there. So I am confused. Does this command ALTER TABLE table_name OWNER TO user; even exists in Oracle database?