# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): [passphraseを入力] ※passphraseはログイン時に使用
Enter same passphrase again: [passphraseを入力]
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Fyfc0Do9Wux/6uZgjLvM9nCq4mYVaOphgip9bx8I1eE root@xxxxxxxx.xxxxxxxx.local
The key's randomart image is:
+---[RSA 3072]----+
| . .. |
| o o o. |
| ..E ++o |
| .o . o+= |
| . .o S..= . |
|. . +. ....o. |
|.. + .... o =. |
|o . o = +.* .o .|
|. . *oooo*o.++o |
+----[SHA256]-----+
# ssh-copy-id root@192.168.xxx.xxx
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.xxx.xxx's password: [passwordを入力]
Number of key(s) added: 1
$ lsnrctl start
・・・
STATUS of the LISTENER
------------------------
・・・
Listener Parameter File /usr/oracle/database/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/******/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=******)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
次にCDBを起動
$ sqplus /NOLOG
SQL> startup;
*******
プラガブル・データベースの状態をチェック
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ****** READ WRITE NO
とりあえず接続先をチェック。※多分 CDB$ROOTのハズ
SQL> show CON_NAME;
プラガブル・データベースを起動してみよう
SQL> alter pluggable database ****** open;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ****** READ WRITE NO
CDB作成時に作られたPDBは管理者名が不明で表領域もあるのかどうかも判らなかったので、
dbcaコマンドで別途にPDB(PDB1,PDB2)を追加してみた。
PDBの管理者名はpdbadminとか何となく判るものを作っておく。
表領域の作成にチェックを入れれば作ってくれるので便利。※手順は省略。
ここで、lsnrctl status を何度か叩くと、最後に各PDB名っぽいSERVICE_NAMEの情報が拾えるので
SQL> alter session set container=PDB1;
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 PDB1 READ WRITE NO
※もう自分しかみえなくなっている
※CDBに戻ってPDBをこの状態で、自動起動にする
SQL> alter session set container=CDB$ROOT;
SQL> alter pluggable database all save state;
プラガブル・データベースを終了してみよう
SQL> alter pluggable database ****** close;
Pluggable database altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ****** MOUNTED