Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


clear (ospf | ospf3) database


Syntax (EX Series Switch and QFX Series)


With the primary Routing Engine, delete entries in the Open Shortest Path First (OSPF) link-state advertisement (LSA) database. With the backup Routing Engine, delete the OSPF LSA database and sync the new database with the primary Routing Engine.



Delete all LSAs other than the system’s own LSAs, which are regenerated. To resynchronize the database, the system destroys all adjacent neighbors that are in the state EXSTART or higher. The neighbors are then reacquired and the databases are synchronized.

advertising-router (router-id | self)

(Optional) Discard entries for the LSA entries advertised by the specified routing device or by this routing device.

area area-id

(Optional) Discard entries for the LSAs in the specified area.


(Optional) Discard summary AS boundary router LSA entries.


(Optional) Discard external LSAs.

instance instance-name

(Optional) Delete or discard entries for the specified routing instance only.


(OSPFv3 only) (Optional) Discard interarea prefix LSAs.


(OSPFv3 only) (Optional) Discard interarea router LSAs.


(OSPFv3 only) (Optional) Discard intra-area prefix LSAs.

logical-system (all | logical-system-name)

(Optional) Perform this operation on all logical systems or on a particular logical system.


(Optional) Delete link-local LSAs.

lsa-id lsa-id

(Optional) Discard the LSA entries with the specified LSA identifier.


(Optional) Discard summary network LSAs.


(Optional) Discard network LSAs.


(Optional) Discard not-so-stubby area (NSSA) LSAs.


(Optional) Discard opaque area-scope LSAs.

realm (ipv4-multicast | ipv4-unicast | ipv6-multicast)

(OSPFv3 only) (Optional) Delete the entries for the specified OSPFv3 realm, or address family. Use the realm option to specify an address family for OSPFv3 other than IPv6 unicast, which is the default.


(Optional) Discard router LSAs.

Required Privilege Level


Output Fields

When you enter this command, you are provided feedback on the status of your request.

Sample Output

clear ospf database all

Release Information

Command introduced before Junos OS Release 7.4.

advertising-router router-id, netsummary, network, nssa, opaque-area, and router options added in Junos OS Release 8.3.

area area-id option added in Junos OS Release 8.3.

realm option added in Junos OS Release 9.2.

advertising-router (router-id | self) option added in Junos OS Release 9.5.

advertising-router (router-id | self) option introduced in Junos OS Release 9.5 for EX Series switches.