Académique Documents
Professionnel Documents
Culture Documents
à partir de cmd:
o sqlplus / as sysdba
o ou sqlplus /nolog puis connect / as sysdba;
à partir de sqlplus:
o system/oracle11g puis connect / as sysdba
1. startup open;
2. nn, startup force mount;
3. shutdown normal;
Exercice 2
1. Consulter le schéma du dictionnaire DICT et préciser le rôle de chacun de ses attributs.
describe dict;
Les descriptions des objets sont accessibles via une vue nommée « DICTIONARY ». Cette vue, également accessible via le synonyme public « DICT », interroge la base de
données pour déterminer à quelles vues du dictionnaire vous pouvez accéder. Elle recherche également les synonymes publics définis pour ces vues.
3. Identifier le rôle et la structures des tables ou des vues suivantes : ALL_CATALOG, ALL_USERS, ALL_COL_COMMENTS, ALL_VIEWS, USER_TABLES, USER_CATALOG. En
vous aidant le cas échéant du contenu de la table ALL_COL_COMMENTS ou de la documentation Oracle; donner succinctement le rôle de chaque attribut de ces tables.
ALL_CATALOG: tous les tables, views, synonyms, sequences accessible à l'utilisateur
ALL_USERS: Informations sur tous les utilisateurs de la base de données
ALL_COL_COMMENTS: Commentaires sur les colonnes des vues et des tables accessibles par l'utilisateurs
ALL_CONSTRAINTS: Liste des contraintes sur les tables accessible par l'utilisateur
ALL_VIEWS: Description des vues accessible / utilisateur
USER_TABLES: Description des tables possédées par l'utilisateur
USER_CATALOG: Liste des indexes, tables, vues, clusters, synonymes et séquences possédés par l'utilisateur
4. Donner le rôle et la structure des tables (ou vues) suivantes : ALL_CONSTRAINTS, ALL_CONS_COLUMNS. Quels sont les types de contraintes reconnues par Oracle ?
TABLE_NAME VARCHAR2(30) NOT Name associated with the table (or view) with constraint definition
NULL
R_CONSTRAINT_NAME VARCHAR2(30) Name of the unique constraint definition for referenced table
VALIDATED VARCHAR2(13) Whether all data obeys the constraint (VALIDATED or NOT VALIDATED)
GENERATED VARCHAR2(14) Whether the name of the constraint is user or system generated
BAD VARCHAR2(3) A YES value indicates that this constraint specifies a century in an ambiguous manner. To avoid errors resulting from
this ambiguity, rewrite the constraint using the TO_DATE function with a four-digit year.
See Also: the TO_DATE function inOracle Database SQL Referenceand Oracle Database Application Developer's Guide -
Fundamentals
INDEX_NAME VARCHAR2(30) Name of the index (only shown for unique and primary-key constraints)
ALL_CONS_COLUMNS describes columns that are accessible to the current user and that are specified in constraints.
TABLE_NAME VARCHAR2(30) NOT Name of the table with the constraint definition
NULL
COLUMN_NAME VARCHAR2(4000) Name of the column or attribute of the object type column specified in the constraint definition
Note: If you create a constraint on a user-defined REF column, the system creates the constraint on the attributes that
make up the REF column. Therefore, the column names displayed in this view are the attribute names, with
the REF column name as a prefix, in the following form:
"REF_name"."attribute"
POSITION NUMBER Original position of the column or attribute in the definition of the object
5. Quels sont les différents types d'objets standards (attribut TABLE_TYPE) reconnus par Oracle dans son catalogue ?
select distinct(Table_type) from all_catalog;
6. Donner le rôle et le schéma de relation correspondant à la table USER_USERS. Quel est votre nom d'utilisateur Oracle ?
USER_USERS describes the current user. Its columns (except for PASSWORD and PROFILE) are the same as those in DBA_USERS.
select user_name from user_users;
7. Comparer le contenu des tables ALL_CATALOG et USER_CATALOG. Commentaires ?
all catalog contient: owner, table_name, table_type
all_catalog posséde un attribut additionnel % à all_catalog qui est owner
8. Retrouvez le nom de l’instance Oracle, sa version, la machine hôte et l’état de la base (v$instance).
select instance_name,version, host_name,status from v$instance;
INSTANCE_NUMBER NUMBER Instance number used for instance registration (corresponds to the INSTANCE_NUMBERinitialization parameter)
PARALLEL VARCHAR2(3) Indicates whether the instance is mounted in cluster database mode (YES) or not (NO)
STOPPED
STARTED
FAILED - Archiver failed to archive a log last time but will try again within 5 minutes
ARCHIVE LOG
CLEAR LOG
CHECKPOINT
NULL - ALTER SYSTEM SWITCH LOGFILE is hung but there is room in the current online redo log
LOGINS VARCHAR2(10) Indicates whether the instance is in unrestricted mode, allowing logins by all users (ALLOWED, or in restricted
mode, allowing logins by database administrators only (RESTRICTED)
Column Datatype Description
ACTIVE
SUSPENDED
INSTANCE RECOVERY
INSTANCE_ROLE VARCHAR2(18) Indicates whether the instance is an active instance (PRIMARY_INSTANCE) or an inactive secondary instance
(SECONDARY_INSTANCE), or UNKNOWN if the instance has been started but not mounted
A single ALTER SYSTEM QUIESCE RESTRICTED statement quiesces all instances in an Oracle RAC environment.
After this statement has been issued, some instances may enter into a quiesced state before other instances; the system is
quiesced when all instances enter the quiesced state.
BLOCKED VARCHAR2(3) Indicates whether all services are blocked (YES) or not (NO)
9. Retrouver le nom de la base et son mode d’ouverture (v$database).
select name, open_mode from v$database;
10. A l’aide de la vue v$parameters$, les fichiers de contrôle de la base.
V$LOGFILE contains information about redo log files. (select group# from v$logfile;)
12. Identifier les fichiers de données et leur taille à l’aide de la vue v$datafile.
select blocks from v$datafile;
Column Datatype Description
STATUS VARCHAR2(7) Type of file (system or user) and its status. Values: OFFLINE, ONLINE, SYSTEM, RECOVER,SYSOFF (an
offline file from the SYSTEMtablespace)
UNRECOVERABLE_CHANGE# NUMBER Last unrecoverable change number made to this datafile. If the database is in ARCHIVELOGmode, then
this column is updated when an unrecoverable operation completes. If the database is not
in ARCHIVELOG mode, this column does not get updated.
UNRECOVERABLE_TIME DATE Timestamp of the last unrecoverable change. This column is updated only if the database is
in ARCHIVELOG mode.
Column Datatype Description
LAST_CHANGE# NUMBER Last change number made to this datafile (null if the datafile is being changed)
OFFLINE_CHANGE# NUMBER Offline change number of the last offline range. This column is updated only when the datafile is
brought online.
PLUGGED_IN NUMBER Describes whether the tablespace is plugged in. The value is 1 if the tablespace is plugged in and has
not been made read/write, 0 if not.
BLOCK1_OFFSET NUMBER Offset from the beginning of the file to where the Oracle generic information begins. The exact length of
the file can be computed as follows: BYTES + BLOCK1_OFFSET.
AUX_NAME VARCHAR2(513) Auxiliary name that has been set for this file via CONFIGURE AUXNAME
Column Datatype Description
13. Quels sont les noms et les numéros des tablespace ? (v$tablespace)
select TS#,name from v$tablespace;