[ 2015-02-20 ]

Oracle 12c: Migrar Database de non-ASM a ASM usando online relocation data files

Hay muchos artículos que explican cómo migrar una base de datos en filesystem a ASM. Podemos utilizar RMAN para crear una copia de imagen de la base de datos en ASM y hacer un switch a la copia de la base de datos, restaurarla desde los backupset en ASM o hacer un duplicate.
Todas estas características de RMAN están disponibles en versiones Oracle previas a 12c.

En el siguiente post de Marko Sutic,  podemos ver un enfoque ligeramente diferente - utilizando la reubicación online de  datafiles en ASM.

Renaming and Relocating Online Data Files is available from 12c and enables us to rename or relocate data file while the database is open and users are accessing data files. This simplifies datafile management and avoids downtimes even when moving SYSTEM or UNDO tablespaces.

This is 12.1 pluggable single-tenant database I want to migrate from file system to ASM:

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name CDB12C

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    800      SYSTEM               YES     /u01/app/oracle12/oradata/cdb12c/system01.dbf
2    260      PDB$SEED:SYSTEM      NO      /u01/app/oracle12/oradata/cdb12c/pdbseed/system01.dbf
3    740      SYSAUX               NO      /u01/app/oracle12/oradata/cdb12c/sysaux01.dbf
4    585      PDB$SEED:SYSAUX      NO      /u01/app/oracle12/oradata/cdb12c/pdbseed/sysaux01.dbf
5    740      UNDOTBS1             YES     /u01/app/oracle12/oradata/cdb12c/undotbs01.dbf
6    5        USERS                NO      /u01/app/oracle12/oradata/cdb12c/users01.dbf
7    270      PDB:SYSTEM           NO      /u01/app/oracle12/oradata/cdb12c/pdb/system01.dbf
8    605      PDB:SYSAUX           NO      /u01/app/oracle12/oradata/cdb12c/pdb/sysaux01.dbf
9    5        PDB:USERS            NO      /u01/app/oracle12/oradata/cdb12c/pdb/pdb_users01.dbf
10   50       PDB:MARKO            NO      /u01/app/oracle12/oradata/cdb12c/pdb/marko01.dbf

[ 2015-02-09 ]

Oracle Multitenant Database Users

Oracle Multitenant, una opción de Oracle Database 12c, incluye tanto usuarios "common" como "local". Un usuario "common"  se crea en la base de datos "container" (CDB) y tiene el mismo nombre de usuario y contraseña en todas las PDB(pluggable databases) que forman parte de esa CDB.  
Los usuario "common" pueden tener privilegios que se otorgan a nivel de contenedor y otros privilegios que se conceden en cada una de las bases "pluggable". Los privilegios pueden ser diferentes en cada una de las PDB, pero el usuario no necesita ser creado de manera individual en cada una de ellas.
Para crear un "common user" para la CDB y todas las PDB, iniciamos sesión en la base de datos contenedor como SYSTEM y creamos un usuario con CONTAINER = ALL.
Debemos tener en cuenta que todos los nombres de usuario "common" tienen que comenzar con el prefijo C##.

SQLPLUS> CONNECT SYSTEM@root
Enter password: **********
Connected.
SQLPLUS> CREATE USER C##DB_ADMIN
IDENTIFIED BY IronMan4
CONTAINER = ALL;

[ 2015-02-08 ]

EZCONNECT sin contraseña

Algo que me resultó bastante interesante en el blog de  Dan Jankowski 

After encountering this little annoyance for the nth time, I thought I should write it up once and for all, so it is committed to my electronic memory.

The EZCONNECT naming method is a handy way of connecting to an Oracle database by its service name, which avoids the need for aliases in the TNSNAMES file, or lengthy SQL*Net connection strings :

SQL> connect user/password@hostname:port/service_name
Connected.

However, one would expect that if you don’t want to specify the password on the command line, then simply omit the password and await the prompt. But…

SQL> connect user@hostname:port/service_name

ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA

Without the password present, the command interpreter parses the string differently, and (according to Oracle Metalink note 267427.1) treats the service_name as the password and the hostname as the service_name. Basically it’s not handling the syntax very well.

The solution is to quote the part of the connection string after the @ symbol. The actual quoting required may vary by environment, but something along the following lines works in Windows.

SQL> connect user@'hostname:port/service_name'
Enter password:
Connected.

Fuente: https://perfstat.wordpress.com/2015/02/06/ezconnect-without-a-password/

[ 2015-02-04 ]

Documentación de Oradebug 12.1.0.2

Documentación en línea de ORADEBUG DOC en 12.1.0.2.

SQL> oradebug doc

Internal Documentation
**********************

  EVENT                           Help on events (syntax, event list, ...)
  COMPONENT       [<comp_name>]   List all components or describe <comp_name>

ORADEBUG DOC EVENT
SQL> oradebug doc event

Event Help:
***********

  Formal Event Syntax
  --------------------
    <event_spec>   ::= '<event_id> [<event_scope>]
                                   [<event_filter_list>]
                                   [<event_parameters>]
                                   [<action_list>]
                                   [off]'

    <event_id>     ::= <event_name | number>[<target_parameters>]

    <event_scope>  ::= [<scope_name>: scope_parameters]

    <event_filter> ::= {<filter_name>: filter_parameters}

    <action>       ::= <action_name>(action_parameters)

    <action_parameters> ::= <parameter_name> = [<value>|<action>][, ]

    <*_parameters> ::= <parameter_name> = <value>[, ]

12c - Last Successful Login Time in SQL*Plus

En este post de Alex Zaballa: 12c - Last Successful Login Time in SQL*Plus podemos leer sobre una funcionalidad interesante de SQL*Plus que casualmente me resultó útil dias atrás para resolver una situación.

Hago la traducción del mismo:

En Oracle Database 12c, se indrodujo una nueva funcionalidad en la herramienta SQL*Plus, el "Last Successful Login".
SQL*Plus de Oracle Database 12c agrega información en la pantalla de login, por default informa cual es la última fecha y hora de login de usuario.

[oracle@server01]$ sqlplus scott/tiger

SQL*Plus: Release 12.1.0.1.0 Production on Thu Mar 27 16:23:55 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Last Successful login time: Wed Mar 26 2014 16:02:23 +01:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options