# Archives July 2022

##### COMPUTE AREA OF CIRCLE FROM RADIUS IN PYTHON

Describe the issue:

Create a function that uses the circle’s radius as a parameter to compute and return the area of a circle.

The area should be rounded to two decimal places. The round() function is available.

Note 2: Round to 3.14159.

Note3:

You merely need to use the function given; you don’t need to accept any input on this issue.

Format for Input

The number of test cases is stated in the first line. There will be one line of input per test case:
Each testcase’s radius is inputted in integer format on a new line.
Format for Output

Each testcase’s area in float format, rounded to the nearest two decimal places.
Typical Input

Sample Output: 1 5

78.54
Sample justification

Circles with radii of 5 cm have an area of 3.14159 x (5 x 5) = 78.53975 cm2.

Rounding by two numbers results in 78.54 cm2.

Approach:

``````def aoc(r):
a = 3.14 * (r * r)
return round(a,2)

print(aoc(5))``````
##### CONVERT TEMPERATURE RESULTS FROM CELSIUS TO FAHRENHEIT IN PYTHON

Challenge:

Convert the provided temperature from Celsius to Fahrenheit given the degree-degree-day temperature. To achieve this, create a programme. the output to the nearest two decimal places

Note:

Python: To round ans to two decimal places, use round(ans,2).

Java: To round up to two decimal places, use Math.round(val*100, 100).

Note2:

You merely need to use the function given; you don’t need to accept any input on this issue.

Format for Input

There are how many test cases in the first line. The temperature will be represented by a single line of input in float format for each test scenario.

Format for Output

Temperature in float format

Typical Input

1

36.8

Sample Results:

98.24

Approach:

Mathematical Formula:

```F = ( C * 1.8 ) +32
or
F = ( C * 9/5 ) + 32
```

Hint:

```0°C = 32°F
```

Convert Celsius to Fahrenheit

``````#Celsius to Fahrenheit calculator
def ctf(c):
ctfc = (c * 9 // 5) + 32
return round(ctfc,2)

print(ctf(0))
``````

Convert Fahrenheit to Celsius

``````#Fahrenheit to Celsius calculator
def ftc(f):
ftcc = (f - 32) * 5 // 9
return round(ftcc,2)

print(ftc(32))``````
##### Self extraction to /tmp/sfx_xnJAqo failed. ERROR: Installer execution failed (1).

Cause:

Zip files are missing and not fully downloaded

``````[oracle@dcoem13c ~]\$ ./em13400_linux64.bin
Launcher log file is /tmp/OraInstall2022-07-30_01-08-13PM/launcher2022-07-30_01-08-13PM.log.
Extracting the installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Done
Self extraction to /tmp/sfx_xnJAqo failed.
The log is located here: /tmp/OraInstall2022-07-30_01-08-13PM/launcher2022-07-30_01-08-13PM.log.
ERROR: Installer execution failed (1).
``````

Action:

There are 7 zip files for OEM installation but one file is missing

``````[oracle@dcoem13c ~]\$ ls -lrt em13400_linux64*
-rwxrwxrwx. 1 root root  808014516 Jul 30 12:15 em13400_linux64-5.zip
-rwxrwxrwx. 1 root root 2109004737 Jul 30 12:18 em13400_linux64-2.zip
-rwxrwxrwx. 1 root root 2047749474 Jul 30 12:19 em13400_linux64-3.zip
-rwxrwxrwx. 1 root root 2117312528 Jul 30 12:19 em13400_linux64-4.zip
-rwxrwxrwx. 1 root root 2143125187 Jul 30 12:19 em13400_linux64-6.zip
-rwxrwxrwx. 1 root root 1623577684 Jul 30 12:19 em13400_linux64.bin
[oracle@dcoem13c ~]\$ ls -lrt em13400_linux64*|wc -l
6
``````
##### FUNCTION TO CHECK IF A LETTER IS VOWEL OR CONSONANT IN PYTHON

Code:

``````def vow(C):
vowel='AEIOUaeiou'
if C in vowel:
print(1)
else:
print(0)
return 0

``````

I/P:

``vow('t')``

O/P:

``0``

Other way

``````def isvowel(C):
try:
C = input("Enter the word")
if C in "AEIOUaeiou":
print(1)
else:
print(0)
except:
pass
return 0

isvowel('t')``````
##### ORA-13509: error encountered during updates to a AWR tableORA-02291: integrity constraint (ORA-02291: integrity constraint (SYS.WRM\$_SNAPSHOT_FK) violated – parent key not found.) violated – parent key not found

Cause:

After recreation of the AWR, snapshots are not generated and below error is thrown

``````kIsH@Xhydra<>BEGIN
END;
/  2    3    4
BEGIN
*
ERROR at line 1:
ORA-13509: error encountered during updates to a AWR table
ORA-02291: integrity constraint (ORA-02291: integrity constraint (SYS.WRM\$_SNAPSHOT_FK) violated - parent key not found
.) violated - parent key not found
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 99
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 145
ORA-06512: at line 2

kIsH@Xhydra<>!oerr ora 2291
02291, 00000,"integrity constraint (%s.%s) violated - parent key not found"
// *Cause: A foreign key value has no matching primary key value.
// *Action: Delete the foreign key or add a matching primary key.
``````

Action:

Below is the record flow and dependent internal tables for snapshot. If data is not populated in both tables, then snapshots will not be generated

wrm\$_snapshot —> wrm\$_database_instance

``````kIsH@Xhydra<>select STARTUP_TIME,VERSION,DB_NAME,INSTANCE_NAME,LAST_ASH_SAMPLE_ID,PLATFORM_NAME from wrm\$_database_instance;

no rows selected

kIsH@Xhydra<>select count(*) from wrm\$_snapshot;

COUNT(*)
----------
0
``````

Bounce the database

``````kIsH@Xhydra<>startup force;
ORACLE instance started.

Total System Global Area 1459614512 bytes
Fixed Size                  9134896 bytes
Variable Size             369098752 bytes
Database Buffers         1073741824 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.
kIsH@Xhydra<>BEGIN
END;
/  2    3    4

PL/SQL procedure successfully completed.

kIsH@Xhydra<>select STARTUP_TIME,VERSION,DB_NAME,INSTANCE_NAME,LAST_ASH_SAMPLE_ID,PLATFORM_NAME from wrm\$_database_instance;

STARTUP_TIME         VERSION           DB_NAME   INSTANCE_NAME    LAST_ASH_SAMPLE_ID PLATFORM_NAME
-------------------- ----------------- --------- ---------------- ------------------ --------------------
22-JUL-22 07.04.58.0 19.0.0.0.0        TEST      test                              1 Linux x86 64-bit
00 PM

kIsH@Xhydra<>select count(*) from wrm\$_snapshot;

COUNT(*)
----------
1
``````
##### Oracle strongly recommends that you disable the password verification function in your database before proceeding any further – disable password verify function in oracle￼

Cause:

During OEM installation, there is halt in install due to password verify function

disable password verify function in oracle

Action:

1)Disable password verify function

2)Open the PDB

``````SQL> sho pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB\$SEED                       READ ONLY  NO
3 PDB                            MOUNTED
5 OEMPDB                         MOUNTED
SQL> alter pluggable database OEMPDB open;

Pluggable database altered.

SQL> sho pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB\$SEED                       READ ONLY  NO
3 PDB                            MOUNTED
5 OEMPDB                         READ WRITE NO

SQL> alter profile default limit password_verify_function null;

Profile altered.
``````
##### ORA-65025: Pluggable database OEMPDB is not closed on all instances.

Cause:

To drop a PDB, it should not be opened

``````SQL> drop pluggable database OEMPDB including datafiles;
drop pluggable database OEMPDB including datafiles
*
ERROR at line 1:
ORA-65025: Pluggable database OEMPDB is not closed on all instances.
``````

Action:

Close the PDB and drop it

``````SQL> alter pluggable database OEMPDB close;

Pluggable database altered.

SQL> drop pluggable database OEMPDB including datafiles;

Pluggable database dropped.
``````
##### ORA-65086: cannot open/close the pluggable database

Cause:

PDB is unplugged and hence it cannot be opened

``````kIsH@Xhydra<>sho pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB\$SEED                       READ ONLY  NO
3 PDB                            MOUNTED
kIsH@Xhydra<>alter pluggable database PDB open;
alter pluggable database PDB open
*
ERROR at line 1:
ORA-65086: cannot open/close the pluggable database

kIsH@Xhydra<>!oerr ora 65086
65086, 00000, "cannot open/close the pluggable database"
// *Cause:  The pluggable database has been unplugged.
// *Action: The pluggable database can only be dropped.
//

``````

Action:

Drop the PDB , recreate it and then open.

``````kIsH@Xhydra<>drop pluggable database PDB including datafiles;

Pluggable database dropped.

kIsH@Xhydra<>create pluggable database PDB admin user PDB_ADM identified by password;

Pluggable database created.

kIsH@Xhydra<>alter pluggable database PDB open;

Pluggable database altered.

kIsH@Xhydra<>sho pdbs

CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB\$SEED                       READ ONLY  NO
4 PDB                            READ WRITE NO
``````
##### ORA-20000: Statistics collection failed for 533 objects in the schema

Cause:

``````ORA-20000: Statistics collection failed for 533 objects in the schema
ORA-06512: at "SYS.DBMS_STATS", line 42210
ORA-06512: at "SYS.DBMS_STATS", line 42165
ORA-06512: at "SYS.DBMS_STATS", line 42133
ORA-06512: at "SYS.DBMS_STATS", line 42196
ORA-06512: at line 1
``````

Action:

Check for invalid or unusable indexes and rebuild them

``````SQL> select count(*) from dba_indexes where status <> 'VALID';

COUNT(*)
----------
250

select 'alter index '||owner||'.'||index_name||' rebuild online;' from all_indexes where status <> 'VALID';.

Select 'alter index '||index_owner||'.'||index_name||' rebuild partition '||partition_name||' ONLINE;' from all_ind_partitions where status <> 'VALID'

Select 'alter index '||index_owner||'.'||index_name||' rebuild subpartition '||subpartition_name||' ONLINE;' from all_ind_subpartitions where status <> 'VALID'``````
##### ORA-13780: SQL statement does not exist.

Cause:

``````ORA-13780: SQL statement does not exist.
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.PRVT_SQLADV_INFRA", line 445
ORA-06512: at "SYS.DBMS_SQLTUNE", line 637
ORA-06512: at line 4``````

Action:

The error may occur due to long running session and the tuning advisor is generated during the execution of the query. Wait for the SQL execution to complete.