A piculiarity I noticed.
When I try
create table dbname.table_name as select
I get Error creating temporary folder on: hdfs://nameservice1/apps/hive/warehouse. Error encountered near token 'TOK_TMP_FILE'
But If I first do
use dbname;
and then
create table table_name as select
It works. Why is that?
To create table in any database user need to have write permission on current database and database in which table is being created.
I.e. while running create table dbname.table_name as select statement , you need to have write permission on current database as well.
This is known issue reported in jira HIVE-11427.
I use SQL developer and i made a connection to my database with the system user, after I created a user and made a another connection with that user with all needed privileges.
But when I try to proceed following I get the SQL Error
ORA-00942 table or view does not exist.:
INSERT INTO customer (c_id,name,surname) VALUES ('1','Micheal','Jackson')
Because this post is the top one found on stackoverflow when searching for "ORA-00942: table or view does not exist insert", I want to mention another possible cause of this error (at least in Oracle 12c): a table uses a sequence to set a default value and the user executing the insert query does not have select privilege on the sequence. This was my problem and it took me an unnecessarily long time to figure it out.
To reproduce the problem, execute the following SQL as user1:
create sequence seq_customer_id;
create table customer (
c_id number(10) default seq_customer_id.nextval primary key,
name varchar(100) not null,
surname varchar(100) not null
);
grant select, insert, update, delete on customer to user2;
Then, execute this insert statement as user2:
insert into user1.customer (name,surname) values ('michael','jackson');
The result will be "ORA-00942: table or view does not exist" even though user2 does have insert and select privileges on user1.customer table and is correctly prefixing the table with the schema owner name. To avoid the problem, you must grant select privilege on the sequence:
grant select on seq_customer_id to user2;
Either the user doesn't have privileges needed to see the table, the table doesn't exist or you are running the query in the wrong schema
Does the table exist?
select owner,
object_name
from dba_objects
where object_name = any ('CUSTOMER','customer');
What privileges did you grant?
grant select, insert on customer to user;
Are you running the query against the owner from the first query?
Case sensitive Tables (table names created with double-quotes) can throw this same error as well. See this answer for more information.
Simply wrap the table in double quotes:
INSERT INTO "customer" (c_id,name,surname) VALUES ('1','Micheal','Jackson')
You cannot directly access the table with the name 'customer'. Either it should be 'user1.customer' or create a synonym 'customer' for user2 pointing to 'user1.customer'. hope this helps..
Here is an answer: http://www.dba-oracle.com/concepts/synonyms.htm
An Oracle synonym basically allows you to create a pointer to an object that exists somewhere else. You need Oracle synonyms because when you are logged into Oracle, it looks for all objects you are querying in your schema (account). If they are not there, it will give you an error telling you that they do not exist.
I am using Oracle Database and i had same problem. Eventually i found ORACLE DB is converting all the metadata (table/sp/view/trigger) in upper case.
And i was trying how i wrote table name (myTempTable) in sql whereas it expect how it store table name in databsae (MYTEMPTABLE). Also same applicable on column name.
It is quite common problem with developer whoever used sql and now jumped into ORACLE DB.
in my case when i used asp.net core app i had a mistake in my sql query. If your database contains many schemas, you have to write schema_name before table_name, like:
Select * from SCHEMA_NAME.TABLE_NAME...
i hope it will helpful.
Is there a query in db2 9.7 control center wherein I can't DELETE(DROP) all the contents of my schema (including the schema) at once?
My other option is to drop/delete the objects first and then DROP schema..
But I want to DROP THE ENTIRE SCHEMA WITH ALL OBJECTS at once.
DROP SCHEMA <schema_name> CASCADE/RESTRICT didn't work for me.
The ADMIN_DROP_SCHEMA procedure is what you're looking for.
The ADMIN_DROP_SCHEMA procedure is used to drop a specific schema and all objects contained in it.
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.admin.doc/doc/r0022036.htm
First drop all the tables in the schema.
Then try to delete the schema using
DROP SCHEMA SCHEMA_NAME RESTRICT
webchain.in have sample java program, explains how to delete the schema using java program
in case drop schema fails after dropping all the tables with the error SQLCODE=-551, SQLSTATE=42501, try command
grant dbadm on database to USER_NAME
I keep getting error for the following query
ALTER SCHEMA dbo TRANSFER domain-USERS\user.tablename;
I tried other table of the same database with a different name and it works fine. (like username.tablename)
So I think the problem is the hyphen in the username.
I also tried the following query but no help.
ALTER SCHEMA dbo TRANSFER 'domain-USERS\user'.tablename;
ALTER SCHEMA dbo TRANSFER 'domain-USERS\user.tablename';
Thanks
This is the correct syntax to transfer the table [A] from schema [B] into the schema [C].
ALTER SCHEMA C TRANSFER [B].[A]
On the right side of TRANSFER, there shouldn't be a WINDOWS login name.
I am trying to drop a user-defined database, like so:
create database demo;
drop database demo;
But I get the error
Cannot drop the database 'demo',
because it does not exist or you do
not have permission.
One way to sort this out might be to run
SELECT name FROM sys.databases
to see if the database does exist.
Some helpful tips from MSDN:
To use DROP DATABASE, the database
context of the connection cannot be
the same as the database to be
dropped. You could change your
context to, for example USE master
before running DROP
To execute DROP DATABASE, at a
minimum, a user must have CONTROL
permission on the database.
You might find some other useful information there that applies to your specific situation.
create database demo;
drop database demo;
In the above code, if the database is deleted and again tried to delete the database which does not exists will give you the error as you mentioned