-1

I'm trying to learn how to create a PDB from PDB$SEED and I just have one question about this video that has been great at spoon feeding me information. What program is this guy using to mkdir for his create_file_dest directory? Also, where is he creating this directory? Or more importantly, where should one create this directory and how do I know that i'm in the right place? He just exits and creates a directory.. but where?

enter image description here

0

3 Answers 3

2

You're following examples related to Unix/Linux O/s.From your other posts your directory structure is really a big mess and top of all you are creating directories for PDB in Oracle home or Oracle binaries that's a big NO

e.g C:\App\db_home\WINDOWS.X64_193000_db_home>mkdir -p /u01/pdb1/

Follow the Oracle documentation for Windows OFA.

Oracle 19c set up on my Personal desktop

C:\echo %ORACLE_HOME%
C:\app\oracle\product\19.3.0\dbhome_1 --(on your system oracle home should be C:\app\elle\product\19.3.0\dbhome_1)

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> show parameter db_create_file_dest

PARAMETER_NAME                  TYPE        VALUE
------------------------------  ----------  -----------
db_create_file_dest             string      D:\oradata

CDB/PDB datafiles (this is my personal desktop created ORADATA on different drive but as per OFA data files should be placed in ORADATA dir in ORACLE_BASE dir e.g C:\app\oracle\ORADATA)

        SQL>SELECT name FROM v$datafile
        NAME
        ----------------------------------------------------------------------
        D:\ORADATA\ORCL\SYSTEM01.DBF
        D:\ORADATA\ORCL\SYSAUX01.DBF
        D:\ORADATA\ORCL\UNDOTBS01.DBF
        D:\ORADATA\ORCL\PDBSEED\SYSTEM01.DBF
        D:\ORADATA\ORCL\PDBSEED\SYSAUX01.DBF
        D:\ORADATA\ORCL\USERS01.DBF
        D:\ORADATA\ORCL\PDBSEED\UNDOTBS01.DBF
        D:\ORADATA\ORCL\ORCLPDB\SYSTEM01.DBF
        D:\ORADATA\ORCL\ORCLPDB\SYSAUX01.DBF
        D:\ORADATA\ORCL\ORCLPDB\UNDOTBS01.DBF
        D:\ORADATA\ORCL\ORCLPDB\USERS01.DBF
        D:\ORADATA\ORCL\ORCLPDB\EXAMPLE01.DBF

As you can see based on parameter db_create_file_dest all data files are created in root folder D:\ORADATA.Created pdb with parameter file_name_convert('D:\ORADATA\ORCL\PDB$SEED','D:\ORADATA\ORCL\ORCLPDB') instead of using db_create_file_dest(since it's already set in initialization parameter)

Follow the examples with DBCA or SQLPLUS (these examples are on Linux O/S)

Here is the fun part creating tablespaces in PDB

Switch to PDB container

    SQL> CREATE TABLESPACE test;   -- 1 without datafile parameter
    
    Tablespace created.
    
    
    SQL> alter session set db_create_file_dest='D:\oradata\ORCL\orclpdb';   --2
    
    Session altered.
    
    SQL> create tablespace test01;
    
    Tablespace created.
    
    SQL> create tablespace test03 datafile 'D:\ORADATA\ORCL\ORCLPDB\TEST03.DBF' size 100M;  --3 with datafile parameter
    
    Tablespace created.
    SQL>COL T_NAME FORMAT A6
    SQL>select t.name t_name,d.name datafile
    from v$datafile d
    join v$tablespace t
    on d.ts#=t.ts#
    where t.ts# in (select ts# from v$tablespace
    where name like 'TEST%')
     
    T_NAME DATAFILE
     ------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    TEST   D:\ORADATA\ORCL\4A506465BEFC4D16865F184CA10BAD44\DATAFILE\O1_MF_TEST_HNRC8S4O_.DBF                 --1
    TEST01 D:\ORADATA\ORCL\ORCLPDB\ORCL\4A506465BEFC4D16865F184CA10BAD44\DATAFILE\O1_MF_TEST01_HNRCMPH1_.DBF  --2
    TEST03 D:\ORADATA\ORCL\ORCLPDB\TEST03.DBF  --3

Avoid statement number 2.Oracle uses internal data file naming convention for tablespaces created without datafile parameters.

Edit:-

Directories in Oracle Base

enter image description here

And ofcourse ORADATA dir should be there (since I set ORADATA in differnt drive it's not in the image).

In future on windows First make oracle home dir from command prompt(I have 18.3 zip files.)

C:\mkdir -p C:\app\oracle\product\18.3\db_home1

Then extract into above dir

enter image description here

6
  • This is super helpful, thank you! But I have a question. I don't have a directory that looks like C:\app\oracle\product\19.3.0\dbhome_1. I don't have the product\v\dbhome part anywhere. What i have is: A: C:\App\db_home which has 2 folders: oradata and WINDOWS.X64_193000_db_home and B: C:\Program Files\Oracle\Inventory which has 2 folders: ContentsXML and logs. How do i find what my oracle home should be? Commented Aug 31, 2020 at 0:21
  • Because you created database from unzipped folder instead of renaming and moving unzipped folder.For now you're stuck with that.In future follow the OFA directory structure.Is this production server,can you afford downtime?.
    – Joe
    Commented Aug 31, 2020 at 0:27
  • This isn't a production server, this is my own personal computer for my first project where I struggle to understand basic things. So I can afford down time. Weird, I definitely extracted the contents of the zipped file. I followed a tutorial, and I just went back to check what I did. The tutorial told me to make a directory C:\App\db_home and extract the zipped file i downloaded from oracle there. Should I delete the database and just do it over? What's the downside in leaving it the way it is? Also, if i leave it, where should my oracle_home directory be? Commented Aug 31, 2020 at 0:44
  • If it's not a production server not a big deal and there is no harm or downside leaving as it is.But make sure datafiles are created in ORADATA directory (check db_create_file_dest)
    – Joe
    Commented Aug 31, 2020 at 1:52
  • 1
    You tried to create a directory in Oracle Home for Pluggable database.Oracle recommends to create directories(OFA) to segregate data files,oracle home and logs etc which is a standard practice and makes easier to locate,maintenance with Oracle multiple homes and versions.This topic is too big for the comments just follow OFA documentation and also read this old documentation shows the difference between non OFA compliant and OFA compliant in Oracle 8
    – Joe
    Commented Sep 2, 2020 at 15:00
0

What do you mean "What program is this guy using to mkdir for his create_file_dest file? "

He is at the shell prompt. He is using the shell's own internal 'mkdir' command.

Where is he creating this file? It's not a file, it's a directory. WHEN you finally get to set CREATE_FILE_DEST (which is an initialization parameter for the database) then then database will use that directory as the default location for any data files created with the oracle CREATE TABLESPACE or ALTER TABLESPACE .. ADD DATAFILE' commands.

4
  • (Yep, my bad, i mean directory, not file). Ok, he's using windows, so is he using command prompt? It doesn't look like it to me. I guess I just wanted to follow along, but my cmd doesn't look like that. When he exits, the prompt says 'oracle@ip-172-31-37-206~'. What is that? How do I navigate to an equivalent place on my computer? Because when I open up cmd, the default place is 'C:\Users\ellie'. So my question is how do i navigate to the place where I should type 'mkdir some_directory'? Does it matter where I put this directory? Commented Aug 30, 2020 at 16:26
  • I understand that CREATE_FILE_DEST is an initialization parameter. My question is about where I make that directory, how people know where they are supposed to make it, and how to navigate there. Commented Aug 30, 2020 at 16:28
  • I didn't have the patience to sit through such a poor presentation, but it seems obvious to me he is using Linux, not windows. 'oracle@ip-172-31-37-206~' is simply what he has his command prompt set to, just like Windows cmd.exe sets the command prompt to the current directory. There's no place you have to navigate to. 'mkdir' is a built-in command in both cmd.exe and in the linux shell processor. Look up the 'mkdir' command.
    – EdStevens
    Commented Aug 30, 2020 at 16:55
  • As for where to make the directory (and set CREATE_FILE_DEST), I said earlier "database will use that directory as the default location for any data files created with the oracle CREATE TABLESPACE or ALTER TABLESPACE .. ADD DATAFILE' commands.' So make it whereever you want your database's data files to go. For this, please consider the rules of Optimal Flexible Architecture (OFA). I leave it as an exercise for the student to look that up in the version and OS-specific Oracle Database Installation Guide.
    – EdStevens
    Commented Aug 30, 2020 at 16:59
0

The answer is it doesn't matter where the CREATE_FILE_DEST directory is.

2
  • Well, the database may not care, but as a DBA, you should care a great deal.
    – EdStevens
    Commented Aug 30, 2020 at 21:23
  • @EdStevens yeah, i was asking if there's a best practices philosophy on where i should put that. I guess i'll go read OFA. Commented Aug 30, 2020 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.