Sunday, August 27, 2023

 

Failed to restart network.service: Unit network.service not found” in CENT OS 9

Network scripts are deprecated from Cent OS/Red Hat Enterprise Linux 8 and onward, no longer available by default. The new installation provides ifup and ifdown scripts which call "NetworkManager " service and use nmcli interface to control network manager.

Version:  Linux localhost.localdomain 5.14.0-354.el9.x86_64

 

 

So, you can use network manager instead and nmcli interface.

 

 You may use ifdown/ifup commands. If these commands are not working, Please Install package 'NetworkManager-initscripts-updown' and then try again.

 

 

Thursday, February 11, 2021

 

Create PDB from Non-CDB in 18c

Non-CDB - PXP

Multitenant - CDB

Non-CDB : Shutdown, mount exclusive, read only mode:

>set ORACLE_SID=PXP
 
>sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Fri Feb 12 12:00:30 2021
Version 18.8.0.0.0

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


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.8.0.0.0
 
SQL> select name,open_mode,cdb from v$database;

NAME      OPEN_MODE            CDB
--------- -------------------- ---
PXP       READ WRITE           NO 

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
 
SQL> startup mount exclusive;
ORACLE instance started.

Total System Global Area 1.0268E+10 bytes
Fixed Size                 12339080 bytes
Variable Size            1979711488 bytes
Database Buffers         8254390272 bytes
Redo Buffers               21213184 bytes
Database mounted.
SQL> alter database open read only;

Database altered.
        

Create PDB manifest file from non-CDB and Shutdown:

SQL> exec dbms_pdb.describe(pdb_descr_file=>'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml');
 
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

Connect CDB and Create PDB from Non-CDB:

SQL> select name,open_mode from v$pdbs;

NAME          
OPEN_MODE
----------         --------------------
PDB$SEED  
READ ONLY
PDB1             READ WRITE

Check compatibility:

SQL> SET SERVEROUTPUT ON;
SQL>  DECLARE
  2   Compatible CONSTANT VARCHAR2(3) :=CASE  DBMS_PDB.CHECK_PLUG_COMPATIBILITY
  3   (pdb_descr_file => 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml')
  4   WHEN TRUE THEN 'YES'
  5   ELSE 'NO'
  6   END;
  7   BEGIN
  8      DBMS_OUTPUT.PUT_LINE(compatible);
  9   END;
 10   /
YES

PL/SQL procedure successfully completed.

SQL> SELECT name, cause, type, message, status FROM PDB_PLUG_IN_VIOLATIONS WHERE name='PXP';

NAME
--------------------------------------------------------------------------------
CAUSE                                                            TYPE
---------------------------------------------------------------- ---------
MESSAGE
--------------------------------------------------------------------------------
STATUS
---------
PXP
Non-CDB to PDB                                                   WARNING
PDB plugged in is a non-CDB, requires noncdb_to_pdb.sql be run.
PENDING

 No violations found. The warning noncdb_to_pdb.sql should be executed after PDB creation.

Create pluggable database using manifest file created earlier:

SQL> CREATE PLUGGABLE DATABASE PXP USING 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml'
  2  COPY
  3  FILE_NAME_CONVERT = ('C:\Apps\ORADATA','C:\Apps\ORADATA\CDB\PXP\');
CREATE PLUGGABLE DATABASE PXP USING 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml'
*
ERROR at line 1:
ORA-01276: Cannot add file
C:\APPS\ORADATA\CDB\PXP\\PXP\DATAFILE\O1_MF_SYSTEM_J2CY9QDX_.DBF.  File has an
Oracle Managed Files file name.

 Trying with SOURCE_FILE_NAME_CONVERT also got error and failed to create.

SQL> CREATE PLUGGABLE DATABASE PXP USING 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml'
  2  COPY
  3  SOURCE_FILE_NAME_CONVERT = ('C:\Apps\ORADATA','C:\Apps\ORADATA\CDB\PXP\');
CREATE PLUGGABLE DATABASE PXP USING 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml'
*
ERROR at line 1:
ORA-19505: failed to identify file
"C:\APPS\ORADATA\CDB\PXP\\PXP\DATAFILE\O1_MF_SYSTEM_J2CY9QDX_.DBF"

ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 3) The system cannot find the path specified.

The solution is to omit file name conversion and let OMF to take care of creating datafiles.

SQL> CREATE PLUGGABLE DATABASE PXP USING 'C:\Apps\ORADATA\PXP\noncdb18c_manifestfile.xml' COPY;

Pluggable database created.

SQL> alter session set container=PXP;

Session altered.

SQL> select name from v$datafile;

NAME
------------------------------------------------------------------------------------------
C:\APPS\ORADATA\CDB\307726814800481493A138B1E881B9BF\DATAFILE\O1_MF_SYSTEM_J2D7FF2O_.DBF
C:\APPS\ORADATA\CDB\307726814800481493A138B1E881B9BF\DATAFILE\O1_MF_SYSAUX_J2D7FF3L_.DBF
C:\APPS\ORADATA\CDB\307726814800481493A138B1E881B9BF\DATAFILE\O1_MF_UNDOTBS1_J2D7FF4D_.DBF
C:\APPS\ORADATA\CDB\307726814800481493A138B1E881B9BF\DATAFILE\O1_MF_USERS_J2D7FF54_.DBF

 Execute noncdb_to_pdb.sql script:

@?/rdbms/admin/noncdb_to_pdb.sql
...
...
PL/SQL procedure successfully completed.
 
Open database and verify the status:
 
SQL> alter pluggable database open;

Pluggable database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         5 PXP                            READ WRITE NO
 
 

 

Tuesday, November 3, 2020

Sysaux Tablespace Growing Rapidly in 12cR2

Solution:  Purge Optimizer Statistics Advisor's Old Records

Check the Top space occupied objects in Sysaux:

SQL> col SEGMENT_NAME format a30
SQL> col OWNER format a10
SQL> col TABLESPACE_NAME format a10
SQL> col SEGMENT_TYPE format a15
SQL> select * from (select SEGMENT_NAME,OWNER,TABLESPACE_NAME,BYTES/1024/1024 "SIZE(MB)",SEGMENT_TYPE from DBA_SEGMENTS where TABLESPACE_NAME='SYSAUX'  order by bytes desc) where ROWNUM<=10;

SEGMENT_NAME                   OWNER      TABLESPACE   SIZE(MB) SEGMENT_TYPE
------------------------------ ---------- ---------- ---------- ---------------
WRI$_ADV_OBJECTS               SYS        SYSAUX           2176 TABLE
WRI$_ADV_OBJECTS_IDX_01        SYS        SYSAUX           1094 INDEX
WRI$_ADV_OBJECTS_PK            SYS        SYSAUX            709 INDEX
SYS_LOB0000007350C00005$$      SYS        SYSAUX        88.1875 LOBSEGMENT
I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST SYS        SYSAUX             88 INDEX
SYS_LOB0000067413C00006$$      MDSYS      SYSAUX         50.125 LOBSEGMENT
I_WRI$_OPTSTAT_H_ST            SYS        SYSAUX             45 INDEX
WRH$_SYSMETRIC_HISTORY_INDEX   SYS        SYSAUX             27 INDEX
I_WRI$_OPTSTAT_HH_OBJ_ICOL_ST  SYS        SYSAUX             23 INDEX
WRH$_SYSMETRIC_HISTORY         SYS        SYSAUX             21 TABLE PARTITION


WRI$_ADV_OBJECTS - This is the table occupies more space in the tablespace,due to optimizer statistics advisor run the task AUTO_STATS_ADVISOR_TASK regularly.             

Check number of records of the task.

SQL> col TASK_NAME format a25
SQL> select TASK_NAME,, COUNT(*) from dba_advisor_objects group by TASK_NAME order by 2 desc;


TASK_NAME                             COUNT(*)
----------------------------------- ----------
AUTO_STATS_ADVISOR_TASK               19212267

...
...
...

65 rows selected.

Check the retention number of days the records to keep in.

SQL> col TASK_NAME format a25
SQL> col parameter_name format a35
SQL> col parameter_value format a20
SQL> set lines 120
SQL> select TASK_NAME,parameter_name, parameter_value FROM DBA_ADVISOR_PARAMETERS WHERE task_name='AUTO_STATS_ADVISOR_TASK' and PARAMETER_NAME='EXECUTION_DAYS_TO_EXPIRE';
 
TASK_NAME                 PARAMETER_NAME                      PARAMETER_VALUE
------------------------- ----------------------------------- --------------------
AUTO_STATS_ADVISOR_TASK   EXECUTION_DAYS_TO_EXPIRE            UNLIMITED

Also, you may check the entries

SQL> col task_name format a25
SQL> col EXECUTION_NAME format a15
SQL> select TASK_ID,TASK_NAME,EXECUTION_NAME ,execution_start from dba_advisor_executions where TASK_NAME='AUTO_STATS_ADVISOR_TASK';

   TASK_ID TASK_NAME                 EXECUTION_NAME  EXECUTION
---------- ------------------------- --------------- ---------
        23 AUTO_STATS_ADVISOR_TASK   EXEC_95         04-NOV-19
        23 AUTO_STATS_ADVISOR_TASK   EXEC_97         04-NOV-19
        23 AUTO_STATS_ADVISOR_TASK   EXEC_99         05-NOV-19
        23 AUTO_STATS_ADVISOR_TASK   EXEC_109        06-NOV-19
.....
.....
        23 AUTO_STATS_ADVISOR_TASK   EXEC_3140       01-NOV-20
        23 AUTO_STATS_ADVISOR_TASK   EXEC_3147       02-NOV-20
        23 AUTO_STATS_ADVISOR_TASK   EXEC_3157       03-NOV-20

366 rows selected.

As the value is unlimited , there is no expiry has been set to.  Hence,  we will set as per our requirement. Here, we set 90 days of records to keep.

SQL> EXEC DBMS_ADVISOR.SET_TASK_PARAMETER(task_name=> 'AUTO_STATS_ADVISOR_TASK', parameter=> 'EXECUTION_DAYS_TO_EXPIRE', value => 90);

PL/SQL procedure successfully completed.

We can delete manually or we could leave it to auto purge.

Here, we test the manual purge.

SQL> exec prvt_advisor.delete_expired_tasks; 
 
PL/SQL procedure successfully completed.

Please note the difference after purge the records.

SQL> col TASK_NAME format a25
SQL> select TASK_NAME,, COUNT(*) from dba_advisor_objects group by TASK_NAME order by 2 desc;
 
TASK_NAME                             COUNT(*)
----------------------------------- ----------
AUTO_STATS_ADVISOR_TASK               3028810

Note: The manual purge will generate more undo if there are huge number of records.



Wednesday, October 21, 2020

Configure Network in Linux Virtual Machine Running on Virtual Box

Linux: Oracle Linux 6.7

Virtual Box:  6.0

Ipaddress: 192.168.56.72

Netmask:   255.255.255.0

Device: eth0

1) Note the MAC address from Virtual box settings:

    0800275A1A80

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2) From the Linux machine, Go to System --> Preferences --> network connections:

     Edit eth0 and enter the ipadress and netmask and apply.



 

 

 

 

 

 

 

 

 

 

 

 

 

 

   

 

3)   Edit /etc/sysconfig/network-scripts/ifcfg-eth0, check the ipaddress and netmask are correct and modify the HWADDR as 08:00?27:5A:1A:80.

 


 

   

     

 

 

 

 

 

 

 

 

  

4) Edit /etc/udev/rules.d/70-persistent-net.rules and update the ATTR(address=='08:00:27:5A:1A:80' for eth0

    

5) Reboot the server. 
6) Check the network status : 

 

 


 

 

 

 

7) Check the ipconfig








ScyllaDB vs Cassandra: What Makes ScyllaDB the Better Choice? For years, Apache Cassandra has been a go-to NoSQL database for applications...