Please help with direction on how to drop a database in Teradata.
When I run the command DROP DATABASE database_name, I get the error message:
*** Failure 3552 Cannot DROP databases with tables, journal tables,
views, macros, or zones.
Statement# 1, Info =0
*** Total elapsed time was 1 second.
You need to run this command first to delete all of the objects in the database:
DELETE DATABASE database_name;
In order to drop a database with journal tables:
MODIFY DATABASE database_name AS DROP DEFAULT JOURNAL TABLE;
Then run,
DROP DATABASE database_name
to delete the database in Teradata
Related
I am running into issues with executing the .purge command within Azure Data Explorer (Kusto).
Command:
.purge table myTable records <| where MyColumn == 'ColumnName'
Results in a
Error Principal 'aaduser=[ID]' is not authorized to perform operation 'PurgeTableRecordsCommand' on 'https://[cluster url]/'. clientRequestId: KustoWebV2;[ID]
Also running the example from : https://learn.microsoft.com/en-us/azure/kusto/concepts/data-purge
.purge table myTable records in database myDB <| where MyColumn in ('column1')
Results in a
Error Syntax error: Query could not be parsed:
I have checked with Access Control (IAM) on the cluster resource and contacted Azure team about my role/permissions and have Contributor role on the cluster and Database Admin role on the database.
I'm trying to import a DB dump {Oracle XE 11g (11.2.0.2.0)}, created by using the EXPDP command. Following is the command that I used to import.
impdp vnp/vnp directory=MY_DATA_PUMP_DIR dumpfile=EXPDP_DUMP_26_01_2018.DMP remap_schema=VNP_ADMIN:VNP remap_tablespace=SYSTEM:USERS,DATA:USERS;
When I run this command, I get a lot of errors containing the same reason
ORA-00959: tablespace 'USERS;' does not exist
However, when I run select tablespace_name from dba_tablespaces; I see that USERS tablespace is present.
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
After reading a few related questions, I saw that it could be related to privileges for the user VNP and I have provided privileges too.
SQL> alter user vnp quota unlimited on users;
User altered.
SQL> grant UNLIMITED TABLESPACE to vnp;
Grant succeeded.
Still I'm getting the same error when I try to import this DB dump. Can you please point me to a correct direction as to why this happens..? Thanks in advance.
How trivial!
ORA-00959: tablespace 'USERS;' does not exist
^
tablespace doesn't really have a semi-colon as a part of its name, eh?
IMPDP is ran at the operating system command prompt. As such, it doesn't require (and shouldn't have) a terminator (as opposed to SQL commands).
Additionally, if it still doesn't work once you remove the semi-colon, try to split REMAP_TABLESPACE in two:
remap_tablespace=SYSTEM:USERS remap_tablespace=DATA:USERS
We want to be able to pin all sql executions to a particular schema_version table in schema A. We need this so that we can run sqls as a sysdba and flyway always references A.schema_version to validate checksums and update result of SQL runs. We tried by adding the following settings:
flyway.schemas=A
flyway.table=schema_version
However we find that if we run info as user B then flyway is not able to show it can read A.schema_version. What are we missing?
Found out the solution. Schemas is case sensitive as specified in the flyway docs. We needed to reference flyway.schemas= where schema_name is in caps
I have two database HB and DSHB. I am trying to create REFRESH FAST ON DEMAND materialized view in DSHB schema wherein HB is remote schema using dblink with following code,
CREATE materialized view MV_HB_SYSTEM
BUILD IMMEDIATE
REFRESH FAST
ON DEMAND
WITH PRIMARY KEY
AS
SELECT DELETED, SYS_NO FROM HB.HB_SYSTEM#HBLINK;
But getting following error in creation,
SQL Error: ORA-12018: following error encountered during code generation for "HB"."MV_HB_SYSTEM"
ORA-00942: table or view does not exist
But on running query " SELECT DELETED, SYS_NO FROM HB.HB_SYSTEM#HBLINK;" in separate connection works perfectly.
I have also created Materialized View Log with following code,
CREATE Materialized View Log ON HB_SYSTEM;
I have found in some forum that SELECT privilege on Materialized View Log needs to be granted as mentioned below,
GRANT SELECT ON MLOG$_<tableName> to DSHB;
where DSHB is the account that will accessing the log (ie via the db link).
But when i run this command from HB schema i am getting error stating DSHB user or role is unavailable in HB and i am unable to grant SELECT on Materialized View Log in HB schema. Is it possible to directly grant SELECT privilege to dblink from remote schema? i mean something like below query from HB schema. I tried but didnt work.
GRANT SELECT ON MLOG$_<tableName> to HB.HB_SYSTEM#HBLINK;
Please suggest how to resolve ORA-00942 error and create REFRESH FAST ON DEMAND materialized view.
I have a python script which creates a sqlite database out of some external data. This works fine. But everytime I execute a GROUP BY query on this database, I get an "Error: unable to open database file". Normal SELECT queries work.
This is an issue for both, the sqlite3 library of python and the sqlite3 cli binary:
sqlite> SELECT count(*) FROM REC;
count(*)
----------
528489
sqlite> SELECT count(*) FROM REC GROUP BY VERSION;
Error: unable to open database file
sqlite>
I know that these errors are typically permission errors (I have read all questions which I could find on this topic on StackOverflow), but I'm quite sure it is not in my case:
I'm talking about a readily created database and read requests
I checked the permissions: Both the file and its containing folders have write permissions set
I can even write to the database: Creating a new table is no problem.
The device is not full, it got plenty of space.
Ensure that your process has access to the TEMP directory.
From the SQLite's Use Of Temporary Disk Files documentation:
SQLite may make use of transient indices to implement SQL language
features such as:
An ORDER BY or GROUP BY clause
The DISTINCT keyword in an aggregate query
Compound SELECT statements joined by UNION, EXCEPT, or INTERSECT
Each transient index is stored in its own temporary file. The
temporary file for a transient index is automatically deleted at the
end of the statement that uses it.
You probably can verify if temporary storage is the problem by setting the temp_store pragma to MEMORY:
PRAGMA temp_store = MEMORY;
to tell SQLite to keep the transient index for the GROUP BY clause in memory.
Alternatively, create an explicit index on the column you are grouping by to prevent the transient index from being created.