Pluggable database not showing the users tablespace - oracle

I have oracle 19c multitenant and asm installed.
When I create a container and a pluggable database
by graphic view I can see the users tablespace from the database.
sqlplus / as sysdba
SQL> alter session set container=PDBORCL;
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
But if I create a container and plugable database in silent mode,
I can only see the users tablespace from the container and if I enter the pluggable database, I can't see the users tablespace.
sqlplus / as sysdba
SQL> alter session set container=TESTPDB;
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
I used these commands to create the container and the database
dbca -silent -createDatabase -databaseConfigType SINGLE -databaseType MULTIPURPOSE \
-templateName General_Purpose.dbc -gdbName TEST -sid TEST -createAsContainerDatabase true \
-useLocalUndoForPDBs true -storageType ASM -datafileDestination +DTA01 -recoveryAreaDestination +FRA01 \
-useOMF true -recoveryAreaSize 9000 -memoryMgmtType AUTO_SGA -totalMemory 4000 \
-characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 -emConfiguration NONE -systemPassword Redhat123 \
-sysPassword Redhat123 -redoLogFileSize 200
sqlplus / as sysdba
CREATE PLUGGABLE DATABASE TESTPDB ADMIN USER usradminapp IDENTIFIED BY Redhat123 FILE_NAME_CONVERT = ('+DTA01', '+DTA01 ')

Related

Oracle XE 21c: cannot associate tablespace with user

This is the first time that I am using Oracle.
I am using Oracle XE 21c, within a Docker container (gvenzl/oracle-xe:latest).
I create a tablespace.
I create a user, and I want to associate the previously create tablespace to the use (as default tablespable).
As SYSTEM, I create the tablespace CONCERTO_DATA. Everything is fine:
create TABLESPACE CONCERTO_DATA
datafile 'concerto_data.dbf' size 10M
autoextend on
next 512K
maxsize unlimited;
Then I create the user:
CREATE USER CONCERTO IDENTIFIED BY "password"
TEMPORARY TABLESPACE temp;
GRANT DBA, CREATE ANY TYPE TO CONCERTO;
GRANT EXECUTE ON DBMS_AQADM TO CONCERTO;
GRANT EXECUTE ON DBMS_AQ TO CONCERTO;
GRANT AQ_ADMINISTRATOR_ROLE TO CONCERTO;
GRANT CONNECT TO CONCERTO;
GRANT CREATE TYPE TO CONCERTO;
select username, default_tablespace from dba_users where username = 'CONCERTO';
Everything is fine. The default tablespace associated with the user CONCERTO is USERS.
I try to associate the previously created tablespace CONCERTO_DATA:
alter user CONCERTO default tablespace CONCERTO_DATA;
Then, a get a strange error:
[99999][65048] ORA-65048: erreur détectée lors du traitement de l'instruction DDL en cours dans la base de données pluggable XEPDB1
ORA-00959: le tablespace 'CONCERTO_DATA' n'existe pas
Position: 0
It says that the tablespace CONCERTO_DATA does not exist.
However, the table space exists:
select tablespace_name, con_id, STATUS from cdb_tablespaces WHERE TABLESPACE_NAME='CONCERTO_DATA';
Result is:
CONCERTO_DATA, 1, ONLINE
I have tried to associate the tablespace to the user during the user's creation:
CREATE USER CONCERTO IDENTIFIED BY "password"
DEFAULT TABLESPACE CONCERTO_DATA
TEMPORARY TABLESPACE temp;
But, I get the same error.
I have tried to create the tablespace using the user CONCERTO (instead of SYSTEM). But, I get the same error.
I think that the error is related to the container ID (COND_ID=1).
SELECT CON_ID, NAME FROM V$CONTAINERS;
Result:
1, CDB$ROOT
2, PDB$SEED
3, XEPDB1
I think that the container ID for the tablespace CONCERTO_DATA should be 3 (instead of 1). But I have no idea how to change it.
You probably created the TABLESPACE in the CDB because you forgot to
alter session set container = XEPDB1 ;

How to connect Oracle 19c Database

I am trying to connect to pluggable databases previously created and could not do it.
Option 1
SQL> conn /as sysdba;
Connected.
SQL> conn system/system
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0
Warning: You are no longer connected to ORACLE.
SQL>
Warning: You are no longer connected to ORACLE.
/
Option 2
SQL> show pdbs;
SQL> conn / as sysdba;
Connected.
SQL> show pdbs;
SQL> alter pluggable database orclpdb open;
alter pluggable database open
*
ERROR at line 1:
ORA-01109: database not open
Previously I had connected using sql developer and worked.
Updated
My database is not mounted and I tried to mount it and shows the below error details.
SQL> conn / as sysdba;
Connected.
SQL> show con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL> select open_mode from v$database;
select open_mode from v$database
*
ERROR at line 1:
ORA-01507: database not mounted
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file
'E:\APP\ORACLE\FAST_RECOVERY_AREA\PROD\CONTROLFILE\O1_MF_JCWYX5LY_.CTL' version
102600 inconsistent with file
'E:\APP\ORACLE\ORADATA\PROD\CONTROLFILE\O1_MF_JCWYX5BQ_.CTL' version 102597
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string E:\APP\ORACLE\ORADATA\PROD\CON
TROLFILE\O1_MF_JCWYX5BQ_.CTL,
E:\APP\ORACLE\FAST_RECOVERY_AR
EA\PROD\CONTROLFILE\O1_MF_JCWY
X5LY_.CTL
control_management_pack_access string DIAGNOSTIC+TUNING
This is because the CDB is at MOUNT, not OPEN, you should open the root container before using PDB.
SQL> conn / as sysdba
Connected.
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
To open the CDB, you may issue the following SQL command or bounce it.
SQL> alter database open;
Database altered.
Then show pdbs again.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
If the PDB is still MOUNTED, then you should open it.
SQL> alter pluggable database orclpdb open;
Pluggable database altered.

How do I truncate the Oracle audit table in AWS RDS?

How do I truncate the Oracle audit table in Amazon AWS RDS?
SQL> select count(*) from sys.aud$;
COUNT(*)
----------
1358
SQL> truncate table sys.aud$;
truncate table sys.aud$
*
ERROR at line 1:
ORA-01031: insufficient privileges
Connect as the admin user and run this rdsadmin command:
SQL> exec rdsadmin.rdsadmin_master_util.truncate_sys_aud_table;
PL/SQL procedure successfully completed.
SQL> select count(*) from sys.aud$;
COUNT(*)
----------
0

tnslistener does not currently know of sid given in connect descriptor oracle11g after database successfully created

I've created a database in oracle 11g with the following commands:
oradim -NEW -SID TA -STARTMODE auto
sqlplus /as sysdba /nolog #CreateDatabase.sql
conn / as sysdba
CREATE SPFILE='C:/Databases/Tamiflu/tamifludb.ora' FROM PFILE='C:/Databases/Tamiflu/inittamiflu.ora';
SHUTDOWN
startup nomount pfile="C:/Databases/Tamiflu/inittamiflu.ora';
CREATE DATABASE db name
USER SYS IDENTIFIED BY EuroRSCG1
USER SYSTEM IDENTIFIED BY EuroRSCG1
LOGFILE GROUP 1 ('C:/Databases/Tamiflu/Logs/redo01.log') SIZE 100M,
GROUP 2 ('C:/Databases/Tamiflu/Logs/redo02.log') SIZE 100M,
GROUP 3 ('C:/Databases/Tamiflu/Logs/redo03.log') SIZE 100M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE 'C:/Databases/Tamiflu/Data/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE 'C:/Databases/Tamiflu/Data/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE tbs_1
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE 'C:/Databases/Tamiflu/Data/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE 'C:/Databases/Tamiflu/Data/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
It successfully executes.
Then when I try to view the DB in SQL Developer, it says it doesn't know the SID. But I established the SID earlier.
I don't know how to clear oracle's SID cache or. What to do now.
A few things don't add up here
The instance is named ta
The database init.ora file is named tamiflu
The create database statement is not correct. what is the database name ? db_name?
All of these values should be consistent.

Oracle DB won't allow users to query tables

I am on Windows XP running Oracle 10G XE Edition.
After running a defrag & cleanup process, I have not been able to access any of the objects on the database.
A quick check
set lines110
col strtd hea 'STARTED'
col instance_name for a8 hea 'INSTANCE'
col host_name for a15 hea 'HOSTNAME'
col version for a10
select instance_name, version, host_name, status
, database_status, to_char(startup_time,'DD-MON-YYYY HH:MI:SS') strtd
from v$instance;
returns this
INSTANCE VERSION HOSTNAME STATUS DATABASE_STATUS STARTED
-------- ---------- --------------- ------------ ----------------- ----------------------------------------------------
xe 10.2.0.1.0 DT8775C MOUNTED ACTIVE 03-DEC-2010 11:38:00
If I use this command, it throws the following error.
SQL> ALTER DATABASE OPEN;
ALTER DATABASE OPEN
*
*ERROR at line 1:*
ORA-16014: log 2 sequence# 679 not archived, no available destinations
ORA-00312: online log 2 thread 1:
'D:\ORACLEEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\O1_MF_2_4JD5RZC0_.LOG'
How can I fix this situation?
There are zero files in the
"D:\ORACLEEXE\APP\ORACLE\FLASH_RECOVERY_AREA\XE\ONLINELOG\" folder.
I'm pretty sure this belongs on SERVERFAULT, but to get you going for now:
It appears the database is in ARCHIVELOG mode and you have not supplied a location to store the archived log files. A quick fix, assuming you don't need the recovery protection that archive logging gives you is to try this:
sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE NOARCHIVELOG;
SQL> ALTER DATABASE OPEN;
If you do want to keep your archived redo logs, then you'll need entries like this in your database parameters:
alter system set log_archive_dest_1='location=d:\oraclexe\app\oracle\...';
alter system set log_archive_dest_state_1=enable;
Sounds like in your cleanup process you may have deleted the .LOG files. I assume you've emptied the trash and can't restore them?

Resources